You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using imports in a if TYPE_CHECKING block, autodoc often fails to resolve the reference. It's not entirely clear to me when this is the case, since sometimes it seems to work and sometimes it does not.
Running the provided example will fail to resolve the reference for timedelta and issue the following warning about it:
/***/thing.py:docstring of thing.foo:1: WARNING: py:class reference target not found: timedelta
How to Reproduce
thing.py
from __future__ importannotationsfromtypingimportTYPE_CHECKINGifTYPE_CHECKING:
fromdatetimeimporttimedeltadeffoo(bar: timedelta) ->None:
pass
Describe the bug
When using imports in a
if TYPE_CHECKING
block, autodoc often fails to resolve the reference. It's not entirely clear to me when this is the case, since sometimes it seems to work and sometimes it does not.Running the provided example will fail to resolve the reference for
timedelta
and issue the following warning about it:How to Reproduce
thing.py
conf.py
index.rst
Environment Information
Sphinx extensions
Additional context
No response
The text was updated successfully, but these errors were encountered: