Skip to content

[tracker] Issues related to autodoc and "undefined reference" #11991

Open
15 of 40 issues completed
Open

Description

@picnixz

This issue serves as a tracker for issues related to autodoc and its inability to render types. Feel free to dump the issues you find relevant and I'll add them to this tracker. That way, people can easily find them and we can also find what is missing or not.

TYPE_CHECKING guarded imports

Forward References and from __future__ import annotations

Type variables and new types treated as data instead of class

Undefined references to pathlib.Path and co.

None and Optional not linking correctly:

Using optional as keyword misidentified as type:

Literal types not linking correctly:

Returns section types not linking:

Yield section types not linking correctly:

Generic types not linking:

@dataclass specific linking bugs:

@property return type:

General alias linking problems:

Napoleon specific:

Docstring extraction

Miscellaneous

Under consideration (Python 3.9 failure only)

Tasks issues

Possible solutions

For people that want some solutions:

  • Consider using autodoc_type_aliases (the support is limited and does not work for missing references in class signatures for instance).
  • Ignore the warnings by specifying entries in nitpick_ignore (it does not solve everything but at least you know what is wrong). Be careful though since sometimes names are incorrectly resolved because they are thought to be the same... (e.g., importing docutils.nodes.Node and _pytest.nodes.Node as Node and using Node in an annotation uses the first reference it finds if Node is not available at runtime, e.g., guarded in a TYPE_CHECKING block).
  • Maybe try sphinx-autodoc2 or sphinx-autodoc-typehints.

Activity

  1. electric-coder commented on Feb 21, 2024

    @electric-coder
  2. picnixz commented on Feb 23, 2024

    @picnixz
    Author
  3. pinned this issue on Mar 3, 2024
  4. unpinned this issue on Jul 20, 2024
  5. pinned this issue on Jul 23, 2024
  6. electric-coder commented on Oct 16, 2024

    @electric-coder

    #10793 should be added to the list under the "None and Optional not linking correctly".

    The issue was tagged as extensions:intersphinx but should be retaged as extensions:autodoc.

    This has been reported several times but I couldn't find an "exact" duplicate as comparable posts also conflate other issues.

  7. 25 remaining items

  8. vivodi commented on Mar 24, 2025

    @vivodi
  9. unpinned this issue on Nov 25, 2025
  10. pinned this issue on Dec 5, 2025
  11. unpinned this issue on Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions