You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following google style guide for classes, I added an Attributes: section my classes docstring. As I have PEP 526 annotations (because I use attrs), I did not add types in the docstring., as per the style guide.
When generating the documentation with .. automodule:: from autodoc, with napoleon, the attributes are not typed. I tried using the :undoc-members: flag of automodule, but this resulted in duplicated attributes: one with the explanation, the other with the type-hint.
While it is possible to not use type hints with attrs and replace attr.s(auto_attribs=True) by attr.ib(), this is not an option for e.g. dataclasses. I also tried napoleon_use_ivar=True, which silenced sphinx's warnings but still resulted in two definition of the attribute in the documentation.
It would be nice if napoleon (or autodoc) extracted the type hint of the class, or merged the attributes when using :undoc-members:. That would avoid duplicated types definitions in either the code or the doc. Currently, either the code has an annotation and a type in the docstring, or the generated documentation has two entry for each attribute.
Following google style guide for classes, I added an
Attributes:
section my classes docstring. As I have PEP 526 annotations (because I useattrs
), I did not add types in the docstring., as per the style guide.When generating the documentation with
.. automodule::
fromautodoc
, withnapoleon
, the attributes are not typed. I tried using the:undoc-members:
flag ofautomodule
, but this resulted in duplicated attributes: one with the explanation, the other with the type-hint.While it is possible to not use type hints with
attrs
and replaceattr.s(auto_attribs=True)
byattr.ib()
, this is not an option for e.g.dataclasses
. I also triednapoleon_use_ivar=True
, which silenced sphinx's warnings but still resulted in two definition of the attribute in the documentation.It would be nice if
napoleon
(orautodoc
) extracted the type hint of the class, or merged the attributes when using:undoc-members:
. That would avoid duplicated types definitions in either the code or the doc. Currently, either the code has an annotation and a type in the docstring, or the generated documentation has two entry for each attribute.This might be related to #7582 and #4074 .
Additional info
3.2.1
conf.py
The text was updated successfully, but these errors were encountered: