How to include automatically all classes, methods and functions in a sphinx documentation?

Jon picture Jon · Jan 2, 2013 · Viewed 10.5k times · Source

I try to create a html documentation for a project containing several thousand classes using sphinx and it's autodoc plugin. sphinx-apidoc creates wonderful rst-files, but lacks of an automatic creation of autoclasses and automethods.

Is there a way/command/utility in sphinx to auto-include all variables, functions, classes and decorators in the documentation?

Some sample code of one rst-file:

tagger Package
=================

:mod:`tagger` Package
------------------------
.. automodule:: project.tagger
    :members:


:mod:`client` Module
--------------------
.. automodule:: project.analyzers.tagger.client
    :members:

Answer

Nilesh picture Nilesh · Jan 2, 2013

There is a Sphinx extension which will help you in this called autodoc.

If you want to include the class then you have to write:

.. autoclass:: <ClassName>

Similarly for a method:

.. automethod:: <MethodName>