# :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.

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 :dir:module, :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 :dir:module, :dir:class etc. directive.

Note

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

There are also new config values that you can set: