sphinx.ext.autodoc¶
See also
https://github.com/sphinx-doc/sphinx/tree/master/sphinx/ext/autodoc
https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_typehints
sphinx.ext.autodoc.typehints (autodoc_typehints) (since sphinx 2.4.0, 2020-02-09)
Contents
Description¶
This extension can import the modules you are documenting, and pull in documentation from docstrings in a semi-automatic way.
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.
For this to work, the docstrings must of course be written in correct reStructuredText.
You can then use all of the usual Sphinx markup in the docstrings, and it will end up correctly in the documentation.
Together with hand-written documentation, this technique eases the pain of having to maintain two locations for documentation, while at the same time avoiding auto-generated-looking pure API documentation.