sphinx-mmf-old / doc / ext / autodoc.rst

The default branch has multiple heads

:mod:`sphinx.ext.autodoc` -- Include documentation from docstrings

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 :data:`sys.path` -- adapt your :data:`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.

:mod:`autodoc` provides several directives that are versions of the usual :rst:dir:`module`, :rst:dir:`class` and so forth. On parsing time, they import the corresponding module and extract the docstring of the given objects, inserting them into the page source under a suitable :rst:dir:`module`, :rst:dir:`class` etc. directive.

Note

Just as :rst:dir:`class` respects the current :rst:dir:`module`, :rst:dir:`autoclass` will also do so, and likewise with :rst:dir:`method` and :rst:dir:`class`.

There are also new config values that you can set:

Docstring preprocessing

autodoc provides the following additional events:

The :mod:`sphinx.ext.autodoc` module provides factory functions for commonly needed docstring processing in event :event:`autodoc-process-docstring`:

Skipping members

autodoc allows the user to define a custom method for determining whether a member should be included in the documentation by using the following event:

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.