2017-05-03 10:33:26 -05:00
|
|
|
sphinx-apidoc
|
|
|
|
=============
|
2011-10-07 05:27:19 -05:00
|
|
|
|
|
|
|
Synopsis
|
|
|
|
--------
|
|
|
|
|
2019-05-21 09:13:41 -05:00
|
|
|
**sphinx-apidoc** [*OPTIONS*] -o <*OUTPUT_PATH*> <*MODULE_PATH*>
|
|
|
|
[*EXCLUDE_PATTERN*, ...]
|
2011-10-07 05:27:19 -05:00
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
|
|
|
|
|
|
|
:program:`sphinx-apidoc` is a tool for automatic generation of Sphinx sources
|
2017-05-03 10:33:26 -05:00
|
|
|
that, using the :rst:dir:`autodoc` extension, document a whole package in the
|
|
|
|
style of other automatic API documentation tools.
|
2011-10-07 05:27:19 -05:00
|
|
|
|
2018-01-20 07:17:35 -06:00
|
|
|
*MODULE_PATH* is the path to a Python package to document, and *OUTPUT_PATH* is
|
|
|
|
the directory where the generated sources are placed. Any *EXCLUDE_PATTERN*\s
|
2018-04-11 10:48:45 -05:00
|
|
|
given are `fnmatch-style`_ file and/or directory patterns that will be excluded
|
|
|
|
from generation.
|
|
|
|
|
|
|
|
.. _fnmatch-style: https://docs.python.org/3/library/fnmatch.html
|
2011-10-07 05:47:58 -05:00
|
|
|
|
2014-03-05 00:45:45 -06:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
``sphinx-apidoc`` generates source files that use :mod:`sphinx.ext.autodoc`
|
|
|
|
to document all found modules. If any modules have side effects on import,
|
|
|
|
these will be executed by ``autodoc`` when ``sphinx-build`` is run.
|
|
|
|
|
|
|
|
If you document scripts (as opposed to library modules), make sure their main
|
|
|
|
routine is protected by a ``if __name__ == '__main__'`` condition.
|
|
|
|
|
2011-10-07 05:27:19 -05:00
|
|
|
Options
|
|
|
|
-------
|
|
|
|
|
2017-05-03 10:33:26 -05:00
|
|
|
.. program:: sphinx-apidoc
|
|
|
|
|
2018-01-20 07:17:35 -06:00
|
|
|
.. option:: -o <OUTPUT_PATH>
|
2017-05-03 10:33:26 -05:00
|
|
|
|
|
|
|
Directory to place the output files. If it does not exist, it is created.
|
|
|
|
|
|
|
|
.. option:: -f, --force
|
|
|
|
|
2018-12-25 12:10:25 -06:00
|
|
|
Force overwriting of any existing generated files.
|
2017-05-03 10:33:26 -05:00
|
|
|
|
|
|
|
.. option:: -l, --follow-links
|
|
|
|
|
|
|
|
Follow symbolic links.
|
|
|
|
|
|
|
|
.. option:: -n, --dry-run
|
|
|
|
|
|
|
|
Do not create any files.
|
|
|
|
|
|
|
|
.. option:: -s <suffix>
|
|
|
|
|
|
|
|
Suffix for the source files generated. Defaults to ``rst``.
|
|
|
|
|
2018-01-20 07:17:35 -06:00
|
|
|
.. option:: -d <MAXDEPTH>
|
2017-05-03 10:33:26 -05:00
|
|
|
|
|
|
|
Maximum depth for the generated table of contents file.
|
|
|
|
|
2018-09-02 06:46:25 -05:00
|
|
|
.. option:: --tocfile
|
|
|
|
|
|
|
|
Filename for a table of contents file. Defaults to ``modules``.
|
|
|
|
|
2017-05-03 10:33:26 -05:00
|
|
|
.. option:: -T, --no-toc
|
|
|
|
|
|
|
|
Do not create a table of contents file. Ignored when :option:`--full` is
|
|
|
|
provided.
|
|
|
|
|
|
|
|
.. option:: -F, --full
|
|
|
|
|
|
|
|
Generate a full Sphinx project (``conf.py``, ``Makefile`` etc.) using
|
|
|
|
the same mechanism as :program:`sphinx-quickstart`.
|
|
|
|
|
|
|
|
.. option:: -e, --separate
|
|
|
|
|
|
|
|
Put documentation for each module on its own page.
|
|
|
|
|
|
|
|
.. versionadded:: 1.2
|
2011-10-07 05:27:19 -05:00
|
|
|
|
2017-05-03 10:33:26 -05:00
|
|
|
.. option:: -E, --no-headings
|
|
|
|
|
|
|
|
Do not create headings for the modules/packages. This is useful, for
|
|
|
|
example, when docstrings already contain headings.
|
|
|
|
|
|
|
|
.. option:: -P, --private
|
|
|
|
|
|
|
|
Include "_private" modules.
|
|
|
|
|
|
|
|
.. versionadded:: 1.2
|
|
|
|
|
|
|
|
.. option:: --implicit-namespaces
|
|
|
|
|
|
|
|
By default sphinx-apidoc processes sys.path searching for modules only.
|
|
|
|
Python 3.3 introduced :pep:`420` implicit namespaces that allow module path
|
|
|
|
structures such as ``foo/bar/module.py`` or ``foo/bar/baz/__init__.py``
|
|
|
|
(notice that ``bar`` and ``foo`` are namespaces, not modules).
|
|
|
|
|
|
|
|
Interpret paths recursively according to PEP-0420.
|
|
|
|
|
2017-12-28 16:54:23 -06:00
|
|
|
.. option:: -M, --module-first
|
2017-05-03 10:33:26 -05:00
|
|
|
|
|
|
|
Put module documentation before submodule documentation.
|
|
|
|
|
|
|
|
These options are used when :option:`--full` is specified:
|
|
|
|
|
|
|
|
.. option:: -a
|
|
|
|
|
|
|
|
Append module_path to sys.path.
|
|
|
|
|
|
|
|
.. option:: -H <project>
|
|
|
|
|
|
|
|
Sets the project name to put in generated files (see :confval:`project`).
|
|
|
|
|
|
|
|
.. option:: -A <author>
|
|
|
|
|
|
|
|
Sets the author name(s) to put in generated files (see
|
|
|
|
:confval:`copyright`).
|
|
|
|
|
|
|
|
.. option:: -V <version>
|
|
|
|
|
|
|
|
Sets the project version to put in generated files (see :confval:`version`).
|
|
|
|
|
|
|
|
.. option:: -R <release>
|
|
|
|
|
|
|
|
Sets the project release to put in generated files (see :confval:`release`).
|
2011-10-07 05:27:19 -05:00
|
|
|
|
2017-12-28 16:54:23 -06:00
|
|
|
Environment
|
|
|
|
-----------
|
|
|
|
|
|
|
|
.. envvar:: SPHINX_APIDOC_OPTIONS
|
|
|
|
|
|
|
|
A comma-separated list of option to append to generated ``automodule``
|
|
|
|
directives. Defaults to ``members,undoc-members,show-inheritance``.
|
|
|
|
|
2011-10-07 05:27:19 -05:00
|
|
|
See also
|
|
|
|
--------
|
|
|
|
|
2017-07-11 09:58:20 -05:00
|
|
|
:manpage:`sphinx-build(1)`, :manpage:`sphinx-autogen(1)`
|
2018-01-20 07:17:35 -06:00
|
|
|
|
|
|
|
.. _fnmatch: https://docs.python.org/3/library/fnmatch.html
|