Automatically create a toctree for autodoc classes in Sphinx Automatically create a toctree for autodoc classes in Sphinx python python

Automatically create a toctree for autodoc classes in Sphinx


In your conf.py file for sphinx add

extensions = ['sphinx.ext.autosummary',]# NOTE: Don't overwrite your old extension list! Just add to it!autodoc_default_flags = ['members']autosummary_generate = True

I put the toctree in my index.rst, and it looks like this:

.. autosummary::     :toctree: stubs     Class1     Class2     Class3

See this example for the conf.py settings

and this example for an example of the toctree.

Hope that helps!