I want to generate the documentation of my Python program.
When I generate the documentation, I always execute sphinx-apidoc
to chase the latest code and then execute make html
.
$ sphinx-apidoc -f -o doc .
$ make -C doc html
I use sphinx.ext.inheritance_diagram
to generate class diagram. It is possible to generate class diagram if the following text is inserted to .rst file manually.
.. inheritance-diagram:: mymodule.MyClass1 mymodule.MyClass2
:parts: 1
However the above text is erased by sphinx-apidoc -f
. I want to know how to insert class diagram to sphinx-apidoc automatically w/o loss of chasing latest code.
If possible, I want to specify where the class diagrams are inserted (e.g., before for each .. automodule::
or any other nice approaches).
My Environment:
$ python3 --version
Python 3.5.2
$ pip3 --version
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
$ pip3 freeze | grep Sphinx
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Sphinx==1.5.2