Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
picnixz opened this issue Feb 19, 2024 · 3 comments
Open

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

picnixz opened this issue Feb 19, 2024 · 3 comments

Comments

@picnixz
Copy link
Member

picnixz commented Feb 19, 2024

This issue serves as a tracker for issues related to autodoc and its inhability 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

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.
@electric-coder

This comment was marked as outdated.

@picnixz

This comment was marked as outdated.

@electric-coder
Copy link

electric-coder commented Oct 16, 2024

#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@picnixz @electric-coder and others