Skip to content
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

Intersphinx: Create link for Optional in description even if it is an inherited docstring #10793

Open
1kastner opened this issue Aug 29, 2022 · 0 comments

Comments

@1kastner
Copy link

Is your feature request related to a problem? Please describe.
I realised that sometimes interphinx resolves typing.Optional into a link pointing to the docs and sometimes it doesn't. When it is used as a type hint in the class that is documented, everything works fine. When, on the other hand, the docstring is inherited from another class, then the type inside Optional is still resolved but not the Optional itself. This only applies to the type hint in the description, not in the signature. In the signature, everything works fine!

Describe the solution you'd like
I'd like that a link is introduced for Optional to point to typing.Optional in the Python docs via intersphinx. If that is not possible, I favor consistency over feature-richness.

Describe alternatives you've considered
I could add some code duplication so that no inheritance is necessary. That would be against several deisgn principles.

Additional context
A very similar issue I have encountered when keyword arguments are documented, see #10776. There, however, I can bypass the same issue with using the py obj role. In this issue, however, I cannot do this. One example for this behavior can be seen in https://conflowgen.readthedocs.io/en/latest/api.html#conflowgen.ContainerFlowAdjustmentByVehicleTypeAnalysis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants