Open electric-coder opened 2 years ago
The :undoc-members: option does not include instance attributes without docstrings when used with the .. autoclass:: directive.
:undoc-members:
.. autoclass::
example.py
class Example: """A simple example.""" def __init__(self, one_arg: str = "value"): self.instance_var1 = 123 self.instance_var2 = one_arg
example.rst
example ******* .. autoclass:: example.Example :members: :undoc-members:
conf.py
import os import sys sys.path.insert(0, os.path.abspath(os.path.join('..', '..'))) html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] extensions = [ 'sphinx.ext.autodoc', 'sphinx_rtd_theme' ] autoclass_content = 'class' autodoc_class_signature = "mixed" autodoc_typehints = 'signature' autodoc_preserve_defaults = True add_module_names = False add_function_parentheses = True autodoc_typehints_description_target="all"
Instance attributes without docstrings should be included by autodoc in the documentation if the :undoc-members: option is specified.
Personal project
Windows 10 Pro
3.9.0
4.4.0
autodoc
None
No response
@picnixz can you tag this with the repository's autodoc label please?
Describe the bug
The
:undoc-members:
option does not include instance attributes without docstrings when used with the.. autoclass::
directive.How to Reproduce
example.py
example.rst
conf.py
Expected behavior
Instance attributes without docstrings should be included by autodoc in the documentation if the
:undoc-members:
option is specified.Your project
Personal project
Screenshots
OS
Windows 10 Pro
Python version
3.9.0
Sphinx version
4.4.0
Sphinx extensions
autodoc
Extra tools
None
Additional context
No response