2017-07-11 09:58:20 -05:00
|
|
|
sphinx-autogen
|
|
|
|
==============
|
|
|
|
|
|
|
|
Synopsis
|
|
|
|
--------
|
|
|
|
|
|
|
|
**sphinx-autogen** [*options*] <sourcefile> ...
|
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
|
|
|
|
|
|
|
:program:`sphinx-autogen` is a tool for automatic generation of Sphinx sources
|
2023-04-06 17:11:39 -05:00
|
|
|
that, using the :py:mod:`~sphinx.ext.autodoc` extension, document items included
|
|
|
|
in :rst:dir:`autosummary` listing(s).
|
2017-07-11 09:58:20 -05:00
|
|
|
|
|
|
|
*sourcefile* is the path to one or more reStructuredText documents containing
|
2024-08-22 04:09:13 -05:00
|
|
|
:rst:dir:`autosummary` entries with the ``:toctree:`` option set. *sourcefile*
|
2017-10-01 09:15:53 -05:00
|
|
|
can be an :py:mod:`fnmatch`-style pattern.
|
2017-07-11 09:58:20 -05:00
|
|
|
|
|
|
|
Options
|
|
|
|
-------
|
|
|
|
|
|
|
|
.. program:: sphinx-autogen
|
|
|
|
|
|
|
|
.. option:: -o <outputdir>
|
|
|
|
|
|
|
|
Directory to place the output file. If it does not exist, it is created.
|
|
|
|
Defaults to the value passed to the ``:toctree:`` option.
|
|
|
|
|
|
|
|
.. option:: -s <suffix>, --suffix <suffix>
|
|
|
|
|
|
|
|
Default suffix to use for generated files. Defaults to ``rst``.
|
|
|
|
|
|
|
|
.. option:: -t <templates>, --templates <templates>
|
|
|
|
|
|
|
|
Custom template directory. Defaults to ``None``.
|
|
|
|
|
|
|
|
.. option:: -i, --imported-members
|
|
|
|
|
|
|
|
Document imported members.
|
|
|
|
|
2021-11-09 21:24:47 -06:00
|
|
|
.. option:: -a, --respect-module-all
|
|
|
|
|
|
|
|
Document exactly the members in a module's ``__all__`` attribute.
|
|
|
|
|
2024-06-21 12:29:46 -05:00
|
|
|
.. option:: --remove-old
|
|
|
|
|
|
|
|
Remove existing files in the output directory
|
|
|
|
that are not generated anymore.
|
|
|
|
|
2017-07-11 09:58:20 -05:00
|
|
|
Example
|
|
|
|
-------
|
|
|
|
|
|
|
|
Given the following directory structure::
|
|
|
|
|
|
|
|
docs
|
|
|
|
├── index.rst
|
|
|
|
└── ...
|
|
|
|
foobar
|
|
|
|
├── foo
|
|
|
|
│ └── __init__.py
|
|
|
|
└── bar
|
|
|
|
├── __init__.py
|
|
|
|
└── baz
|
|
|
|
└── __init__.py
|
|
|
|
|
|
|
|
and assuming ``docs/index.rst`` contained the following:
|
|
|
|
|
|
|
|
.. code-block:: rst
|
|
|
|
|
|
|
|
Modules
|
|
|
|
=======
|
|
|
|
|
|
|
|
.. autosummary::
|
|
|
|
:toctree: modules
|
|
|
|
|
|
|
|
foobar.foo
|
|
|
|
foobar.bar
|
|
|
|
foobar.bar.baz
|
|
|
|
|
|
|
|
If you run the following:
|
|
|
|
|
2021-12-12 22:15:58 -06:00
|
|
|
.. code-block:: console
|
2017-07-11 09:58:20 -05:00
|
|
|
|
2020-03-16 09:43:38 -05:00
|
|
|
$ PYTHONPATH=. sphinx-autogen docs/index.rst
|
2017-07-11 09:58:20 -05:00
|
|
|
|
|
|
|
then the following stub files will be created in ``docs``::
|
|
|
|
|
|
|
|
docs
|
|
|
|
├── index.rst
|
|
|
|
└── modules
|
|
|
|
├── foobar.bar.rst
|
|
|
|
├── foobar.bar.baz.rst
|
|
|
|
└── foobar.foo.rst
|
|
|
|
|
2023-04-06 17:11:39 -05:00
|
|
|
and each of those files will contain a :py:mod:`~sphinx.ext.autodoc` directive
|
|
|
|
and some other information.
|
2017-07-11 09:58:20 -05:00
|
|
|
|
|
|
|
See also
|
|
|
|
--------
|
|
|
|
|
|
|
|
:manpage:`sphinx-build(1)`, :manpage:`sphinx-apidoc(1)`
|