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
This is a widespread issue caused by the pattern of defining objects in private module and then exposing them to the final user by importing them in the top-level __init__.py, vs. how intersphinx works.
subclasses any of the classes exposed by xarray/__init__.py and documents the new class with the :show-inheritance: flag
Starting from Sphinx 3, has any of the above classes anywhere in a type annotation
Then Sphinx emits a warning and fails to create a hyperlink, because intersphinx uses the __module__ attribute to look up the object in objects.inv, but __module__ points to the implementation module while objects.inv points to the top-level xarray module.
Workaround
In conf.py:
importxarrayxarray.DataArray.__module__="xarray"
Solution
Put the above hack in xarray/__init__.py
The text was updated successfully, but these errors were encountered:
crusaderky
changed the title
intersphinx trouble with implementation modules
intersphinx looks for implementation modules
Jul 28, 2020
This is a widespread issue caused by the pattern of defining objects in private module and then exposing them to the final user by importing them in the top-level
__init__.py
, vs. how intersphinx works.Exact same issue in different projects:
If a project
xarray/__init__.py
and documents the new class with the:show-inheritance:
flagThen Sphinx emits a warning and fails to create a hyperlink, because intersphinx uses the
__module__
attribute to look up the object in objects.inv, but__module__
points to the implementation module while objects.inv points to the top-levelxarray
module.Workaround
In conf.py:
Solution
Put the above hack in
xarray/__init__.py
The text was updated successfully, but these errors were encountered: