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

StackOverflow https://stackoverflow.com/questions/14120253

  •  13-12-2021
  •  | 
  •  

Question

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:
Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top