Debian Codegraph @

doc/man/sphinx-autogen.rst

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