-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
autodoc type hints and intersphinx aren't working with the requests
public API
#9653
Comments
I have the same problem. I observe that if you have a docstring on the class which contains:
sphinx successfully locates and links the proper page in the requests documentation. There must be some difference between resolving and locating the type hint and resolving and locating the cross-reference. |
I also note that when using Sphinx 4.1 the provided example project does not generate a warning, although it renders the I'm not very familiar with the Sphinx source code, but reviewing the changelog for 4.2 I wonder if #9576 changed this behavior. |
Providing a type hint of |
Sphinx 4.2 has a bug which generates errors rendering type hints for requests: sphinx-doc/sphinx#9653. Sphinx 4.1 does not generate these errors.
It seems the document of requests was built by Sphinx-1.8.5. So an index entry for Can anyone report this to the requests project? |
Done: psf/requests#5954 |
Resolved in psf/requests#5956. |
Describe the bug
It looks like autodoc is resolving type hints like
requests.Response
to their internal definition, e.g.requests.models.Response
. This means the intersphinx references to the Requests API docs don’t work, resulting in build messages likeWARNING: py:class reference target not found: requests.models.Response
.Based on my limited understanding, I think this might actually be an issue with Requests, but I thought I'd start here.
How to Reproduce
I put an example repo with instructions up at https://github.com/bhrutledge/sphinx-requests-typehints, generated via sphinx-apidoc. The rendered docs are at https://sphinx-requests-typehints.readthedocs.io/en/latest/example_package.html.
Expected behavior
It'd be nice if the types for
requests
classes in argument defaults and parameters were linked to the Requests documentation.Your project
https://github.com/bhrutledge/sphinx-requests-typehints
Screenshots
No response
OS
Mac
Python version
3.9.7
Sphinx version
4.2.0
Sphinx extensions
sphinx.ext.autodoc, sphinx.ext.intersphinx
Extra tools
requests
Additional context
No response
The text was updated successfully, but these errors were encountered: