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
Reference targets not found when using autodoc_typehints = "both"
#10305
Comments
It seems some objects are described manually via
But autodoc generates a reference To avoid such mismatches, you can use
This describe |
Note: Dockerfile to reproduce the warnings
|
Wow, thank you for this, I appreciate it a lot. Can I be a bother once more and query something else. If you have a look at this patch: iff --git a/hondana/client.py b/hondana/client.py
index f6e8782..4d59373 100644
--- a/hondana/client.py
+++ b/hondana/client.py
@@ -89,7 +89,7 @@ from .utils import MISSING, require_authentication
if TYPE_CHECKING:
- import aiohttp
+ from aiohttp import ClientSession
from .tags import QueryTags
from .types import common, legacy, manga
@@ -141,7 +141,7 @@ class Client:
username: None = ...,
email: None = ...,
password: None = ...,
- session: Optional[aiohttp.ClientSession] = ...,
+ session: Optional[ClientSession] = ...,
refresh_token: None = ...,
) -> None:
...
... truncated for brevity, but it's just more overloads being edited This then generates the following error:
As this is a third party dependency I cannot edit how this reference is found. I have pushed the changes you suggested to the same branch but am still having some issues with more types. Could I bother you for some more guidance on those too? |
Is there no way to add the The file in question is here. |
Thank you for your explanation. I understand what is your problem. It seems For example, some code refers But autodoc can't know its real object name because it's not evaluated yet (postponed). As a result, autodoc failed to refer it correctly. As a workaround, autodoc provides an option You'll avoid the warnings via this setting:
Additionally, I found a bug of autodoc. |
Thank you so much for the explanation here! It is much appreciated. I have one method with 15 or so overloads, it does not look too nice, hah! |
Sorry, I'm not sure what you're saying. Is the behavior related to |
Thank you for your explanation. I understand. You'll also see the overloads when
Nothing. Please post a feature request as another issue. |
…tations Fix #10305: autodoc: Failed to extract optional forwardrefs
Describe the bug
When using the above directive in my
conf.py
for sphinx, I suddenly get the following output:Previously I had
autodoc_typehints = "none"
, but when changing this behaviour suddenly it cannot find these names/targets.NOTE: I use the following command to generate my docs, hence being able to see all warnings as errors:-
sphinx-build -a -E -n -T -W --keep-going docs/ docs/_build
How to Reproduce
Expected behavior
I expected the docs to build correctly with the resolved types and reference links.
Your project
N/A I think
Screenshots
OS
Linux - Debian 10
Python version
3.9.6
Sphinx version
4.5.0
Sphinx extensions
sphinx.ext.autodoc, sphinx.ext.extlinks, sphinx.ext.intersphinx, sphinx.ext.napoleon, sphinxcontrib_trio, resource_links
Extra tools
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: