autoclasstoc

raw JSON →
1.7.0 verified Fri May 01 auth: no python

Add a succinct table of contents to Sphinx auto-documented classes, making navigation easier. Version 1.7.0, stable and infrequently updated.

pip install autoclasstoc
error Extension error: Could not import extension autoclasstoc (exception: No module named 'autoclasstoc')
cause `autoclasstoc` is not installed in the Python environment used by Sphinx.
fix
Run pip install autoclasstoc in the same environment as Sphinx.
error WARNING: unknown directive: autoclasstoc
cause The extension is not enabled in conf.py or is listed after a broken extension.
fix
Add 'autoclasstoc' to the extensions list and ensure sphinx.ext.autodoc is also present.
gotcha `autoclasstoc` requires `sphinx.ext.autodoc` to be loaded first. If not, the extension silently fails.
fix Ensure `extensions` list has `'sphinx.ext.autodoc'` before `'autoclasstoc'`.
gotcha The `:ignore:` directive does not work with parenthesized names like `__init__(self)`. Use just `:ignore: __init__` (no parentheses).
fix List method names without arguments.
deprecated The `:members:` option on `autoclasstoc` is deprecated and may be removed. It is ignored in modern versions.
fix Remove `:members:` from the `autoclasstoc` directive; it has no effect.

Enable the extension in conf.py, then use the `.. autoclasstoc::` directive in your RST to generate a table-of-contents for auto-documented class members.

extensions = ['sphinx.ext.autodoc', 'autoclasstoc']

# In your .rst file:
# .. autoclasstoc::
#    :ignore: __init__
#    :order: source
#    :sections: Attributes, Methods

# Then use .. autoclass:: to document a class and the TOC appears.