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
No way to override "alias of" text, generated by autodoc #4422
Comments
+1; it's enough reasonable! |
I don't think this is workaround for #2437. This is enough useful for documentation. |
I check this issue again now. And finally I feel this is not needed. #2437 works well to me. |
I would like to request reopening this issue. I have a type alias like this:
which describes the type of a callback function that a user can pass to my copy function. Autodoc currently documents this as:
This is not very helpful, first because the arguments to the I've added an explanation to the copy function documentation instead, but it would be really nice if the alias could also be documented. |
Good point! I agree it is useful. |
Another situation I run into where I had to do code changes to force sphinx generate the docstring.
I did not find a reasonable way to workaround this except doing a code change and setting the default in the |
Is there any progress on this issue? |
I just post #7749 to support GenericAlias like On the other hand, about @pauleikis's case, latest Sphinx works fine for the example pasted here. So I need to more information to reproduce the trouble. Please file an issue if you still have a problem. |
Close #4422: autodoc: Support GenericAlias
Now I fixed the behvior for GenericAlias.
And I don't change other behaviors. Please file an issue if you still have a problem around "alias of" text. |
Issue reopen request. An example of unexpected behavior: from typing import Union, Type
class MyClass:
"""Class ``MyClass`` docstring."""
#: This comment is not displayed.
int_attr = int
#: This comment is not displayed.
typed_attr: Union[Type[int], Type[str]] = int
|
@Abrosimov-a-a Could you file a new issue, please? |
Autodoc has problems with resolving references in such text, if the referenced class belongs to the different module, see #2437.
Before #4176 it was possible to workaround this with the currentmodule directive, e.g. here, where this was done to resolve reference to ANP class from polyclasses. Unfortunately, this was broken in latest two releases.
Another option to workaround #2437 would be using comments to document problematic attribute, e.g.:
Unfortunately, this doesn't work: text "alias of SomeClass" - added after hand-made docstring.
The text was updated successfully, but these errors were encountered: