Automatically Generating Documentation for All Python Package Contents Automatically Generating Documentation for All Python Package Contents python python

Automatically Generating Documentation for All Python Package Contents


You can try using sphinx-apidoc.

$ sphinx-apidoc --helpUsage: sphinx-apidoc [options] -o <output_path> <module_path> [exclude_paths, ...]Look recursively in <module_path> for Python modules and packages and createone reST file with automodule directives per package in the <output_path>.

You can mix sphinx-apidoc with sphinx-quickstart in order to create the whole doc project like this:

$ sphinx-apidoc -F -o docs project

This call will generate a full project with sphinx-quickstart and Look recursively in <module_path> (project) for Python modules.


Note

For Sphinx (actually, the Python interpreter that executes Sphinx) to find your module, it must be importable. That means that the module or the package must be in one of the directories on sys.path – adapt your sys.path in the configuration file accordingly

So, go to your conf.py and add

import an_example_pypi_project.useful_1import an_example_pypi_project.useful_2

Now your index.rst looks like:

.. toctree::   :glob:   example   an_example_pypi_project/*

and

make html