blob: 43cc369b78b378ccf30b8c9fadc2e45d01c453b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
sphinx-autogen
==============
Synopsis
--------
**sphinx-autogen** [*options*] <sourcefile> ...
Description
-----------
:program:`sphinx-autogen` is a tool for automatic generation of Sphinx sources
that, using the :py:mod:`~sphinx.ext.autodoc` extension, document items included
in :rst:dir:`autosummary` listing(s).
*sourcefile* is the path to one or more reStructuredText documents containing
:rst:dir:`autosummary` entries with the ``:toctree::`` option set. *sourcefile*
can be an :py:mod:`fnmatch`-style pattern.
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.
.. option:: -a, --respect-module-all
Document exactly the members in a module's ``__all__`` attribute.
.. option:: --remove-old
Remove existing files in the output directory
that are not generated anymore.
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:
.. code-block:: console
$ PYTHONPATH=. sphinx-autogen docs/index.rst
then the following stub files will be created in ``docs``::
docs
├── index.rst
└── modules
├── foobar.bar.rst
├── foobar.bar.baz.rst
└── foobar.foo.rst
and each of those files will contain a :py:mod:`~sphinx.ext.autodoc` directive
and some other information.
See also
--------
:manpage:`sphinx-build(1)`, :manpage:`sphinx-apidoc(1)`
|