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

autodoc: Allow TypeVars to be reimported from other modules #13277

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

coretl
Copy link
Contributor

@coretl coretl commented Jan 29, 2025

Purpose

To allow autodoc to read the doc comments of TypeVars re-imported from other modules. This allows TypeVars from private modules to be documented there and re-exported as part of the public interface.

References

Fixes #13276

@coretl coretl changed the title #13276: autodoc: Allow TypeVars to be reimported from other modules autodoc: Allow TypeVars to be reimported from other modules Jan 29, 2025
@coretl coretl marked this pull request as draft January 29, 2025 13:56
@coretl
Copy link
Contributor Author

coretl commented Jan 29, 2025

I thought I had fixed it but apparently not. This PR solves half the problem, getting the doc comments from the private module to the public module. Unfortunately all uses of the TypeVar result in a signature that references its original private module, which Sphinx can not resolve. I'm not sure how to solve this, ideally when automodule finds a TypeVar it should tell Sphinx that when it sees a reference to it's private __module__ it should resolve the public location that it published.

I will leave this as draft in case someone else has any ideas, and have put a workaround in the original issue.

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

Successfully merging this pull request may close these issues.

TypeVars imported from another module lose their docstring
1 participant