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
I am new to sphinx and autoapi so I may be missing something, but I searched the documentation and the internet and couldn't find a solution to my problem. I have a foo package which has a bar module and in it there is a Bar class. The Bar class is central to my library, so I decided to make an import shortcut for it. Inside the __init__.py file of the foo package I have the code:
fromfoo.barimportBar__all__= ["Bar"]
So the end user can use from foo import Bar instead of the more verbose from foo.bar import Bar. Since I declared Bar in the __all__ variable, it gets picked up by autoapi and documented in the generated page for the foo package. There is also a page for the foo.bar module which contains the full docstring of the class. The problem is that I can't get the Bar class in the foo page to link to the documentation of Bar on the foo.bar page.
If I have the "imported-members" option in conf.py, the docstring of the Bar class is displayed in both the foo and foo.bar pages with no link between them. This is an unnecessary duplication and it makes the user think that there are two Bar symbols without explaining that one is just an alias for the other. If I disable the "imported-members" option, then the docstring only appears in the foo.bar page and on the foo page, Bar is listed in the package's contents, but that's it. It doesn't link to anything. So the user knows that foo.Bar is an alias, but he doesn't know to what. I'd like the Bar in the foo page to link to the full docstring in the foo.bar page, but I couldn't figure out how to accomplish that.
Any ideas?
The text was updated successfully, but these errors were encountered:
I am new to
sphinx
andautoapi
so I may be missing something, but I searched the documentation and the internet and couldn't find a solution to my problem. I have afoo
package which has abar
module and in it there is aBar
class. TheBar
class is central to my library, so I decided to make an import shortcut for it. Inside the__init__.py
file of thefoo
package I have the code:So the end user can use
from foo import Bar
instead of the more verbosefrom foo.bar import Bar
. Since I declaredBar
in the__all__
variable, it gets picked up byautoapi
and documented in the generated page for thefoo
package. There is also a page for thefoo.bar
module which contains the full docstring of the class. The problem is that I can't get theBar
class in thefoo
page to link to the documentation ofBar
on thefoo.bar
page.If I have the "imported-members" option in
conf.py
, the docstring of theBar
class is displayed in both thefoo
andfoo.bar
pages with no link between them. This is an unnecessary duplication and it makes the user think that there are twoBar
symbols without explaining that one is just an alias for the other. If I disable the "imported-members" option, then the docstring only appears in thefoo.bar
page and on thefoo
page,Bar
is listed in the package's contents, but that's it. It doesn't link to anything. So the user knows thatfoo.Bar
is an alias, but he doesn't know to what. I'd like theBar
in thefoo
page to link to the full docstring in thefoo.bar
page, but I couldn't figure out how to accomplish that.Any ideas?
The text was updated successfully, but these errors were encountered: