Generate from sourceΒΆ
Write the docstrings respecting a certain format.
Documenting from source is straightforward (if the code is packaged)
.. automodule:: mypackage.mymodule
:members:
To show a specific pyobject in the documentation which is defined in a file (using the relative path):
.. literalinclude:: relative/path/from/current/mypackage/mymodule.py
:pyobject: myfunc
:emphasize-lines: 3,4
:linenos:
:caption: my caption
:name: the name
To get an autolabel from literalinclude both the caption and name must be set and the caption will be used as default text link.