-
Notifications
You must be signed in to change notification settings - Fork 100
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
Pandas and Requests classes not linked #47
Comments
This library looks at the module in which the annotation was defined and generates the Sphinx markup based on that. How would you prefer me to fix this? |
I think the problem is that I am not sure of where the problem should be fixed. Is it possible to only resolve the import alias (e.g. |
How do you propose to do the resolution? |
I have taken a quick look at how the An easier possible solution could be to do a search for the module name in the relevant |
Then you have arrived at the exact same conclusion as I. |
I'm presently working on a sphinx extension at my company that resolves this and other annoyances with missing references. It will take a bit of time to open source though as I've been pretty busy lately. |
As a note, although this does result in a bit of repetition, you can simply include |
Could you maybe reopen this issue and mark as |
I haven't had to time to test out the release yet, but here's the extension I mentioned above: https://github.com/23andMe/sphinx-resolve-py-references
And here's what documentation I've been able to write about it... Fixes or warns about missing references to Python objects in the docs The extension is useful because it's often annoying to write out the full path to an object in your docs which you know is imported in the current module. This is also true for neighboring modules which would be easier referenced with This extension addresses these issues by allowing you to reference functions or classes which are imported in the current module as if they had been defined there. This is done by analyzing the AST to find and trace from some_package import MyClass
def my_function():
'''Uses :class:`MyClass`'''
# The above reference would normally fail because `MyClass`
# is not defined in this module. However this extension
# automatically resolves the reference |
Throwing my hat into the ring, I came up with my own fix for this which is also a Sphinx extension: It just lets you define a dictionary mapping the names which didn't resolve, to the correct ones. See the readme in that repository for instructions, the example should fix the original problem at the top of this issue. I didn't actually try out @rmorshea's option first, so it may be better than mine for all I know. Mine is very quick and simple, the whole thing is like 20 lines of Python, mostly imports :) |
The issue described here is no longer occurring to me, at least links to |
Glad to hear it! Wonder what fixes it for you. The only thing that helps me is my workaround, otherwise pd.DataFrame and other types don't link properly. |
Don't know. I use the following entry in 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None), compare https://github.com/audeering/audformat/blob/v0.15.0/docs/conf.py |
I have intersphinx configured properly so that the following markup all link correctly to the relevant documentation:
However, all of these type hints fail to render as links to Pandas documentation, even though the type annotation rendering using
sphinx_autodoc_typehints
looks otherwise just fine:The same goes for classes inside the Requests package.
This is from our
conf.py
:The text was updated successfully, but these errors were encountered: