Python comes along with pydoc. You can use pydoc to auto-generate documentation for your module or package. For this your module or package needs to contain docstrings.
You can execute pydoc directly from terminal. cd to the directory that contains the module that you want to auto-generate a documentation for. Then, execute the following command.
python -m pydoc -w modulename
In this case the module is modulename.py. Above command will generate a .html file that contains the auto-generated documentation.
For a larger project I prefer storing all documentations for all modules in one directory. For this, I first create the documentation for every module. I do so with above command.
Next, I create an empty directory with the command below
mkdir docs
In this case the new directory is called “docs”.
Lastly, I move all auto-generated .html files in the docs directory.
mv *.html docs