Debian Codegraph @

doc/man/sphinx-apidoc.rst

raw
1 sphinx-apidoc
2 =============
3
4 Synopsis
5 --------
6
7 **sphinx-apidoc** [*OPTIONS*] -o <*OUTPUT_PATH*> <*MODULE_PATH*>
8 [*EXCLUDE_PATTERN* ...]
9
10 Description
11 -----------
12
13 :program:`sphinx-apidoc` is a tool for automatic generation of Sphinx sources
14 that, using the :py:mod:`~sphinx.ext.autodoc` extension, document a whole
15 package in the style of other automatic API documentation tools.
16
17 *MODULE_PATH* is the path to a Python package to document, and *OUTPUT_PATH* is
18 the directory where the generated sources are placed. Any *EXCLUDE_PATTERN*\s
19 given are `fnmatch-style`_ file and/or directory patterns that will be excluded
20 from generation.
21
22 .. _fnmatch-style: https://docs.python.org/3/library/fnmatch.html
23
24 .. warning::
25
26 ``sphinx-apidoc`` generates source files that use :mod:`sphinx.ext.autodoc`
27 to document all found modules. If any modules have side effects on import,
28 these will be executed by ``autodoc`` when ``sphinx-build`` is run.
29
30 If you document scripts (as opposed to library modules), make sure their main
31 routine is protected by a ``if __name__ == '__main__'`` condition.
32
33 Options
34 -------
35
36 .. program:: sphinx-apidoc
37
38 .. option:: -o <OUTPUT_PATH>
39
40 Directory to place the output files. If it does not exist, it is created.
41
42 .. option:: -q
43
44 Do not output anything on standard output, only write warnings and errors to
45 standard error.
46
47 .. option:: -f, --force
48
49 Force overwriting of any existing generated files.
50
51 .. option:: -l, --follow-links
52
53 Follow symbolic links. Defaults to ``False``.
54
55 .. option:: -n, --dry-run
56
57 Do not create or remove any files.
58
59 .. option:: -s <suffix>
60
61 Suffix for the source files generated. Defaults to ``rst``.
62
63 .. option:: -d <MAXDEPTH>
64
65 Maximum depth for the generated table of contents file. Defaults to ``4``.
66
67 .. option:: --tocfile
68
69 Filename for a table of contents file. Defaults to ``modules``.
70
71 .. option:: -T, --no-toc
72
73 Do not create a table of contents file. Ignored when :option:`--full` is
74 provided.
75
76 .. option:: --remove-old
77
78 Remove existing files in the output directory
79 that are not created anymore.
80 Not compatible with :option:`--full`.
81
82 .. option:: -F, --full
83
84 Generate a full Sphinx project (``conf.py``, ``Makefile`` etc.) using
85 the same mechanism as :program:`sphinx-quickstart`.
86
87 .. option:: -e, --separate
88
89 Put documentation for each module on its own page.
90
91 .. versionadded:: 1.2
92
93 .. option:: -E, --no-headings
94
95 Do not create headings for the modules/packages. This is useful, for
96 example, when docstrings already contain headings.
97
98 .. option:: -P, --private
99
100 Include "_private" modules.
101
102 .. versionadded:: 1.2
103
104 .. option:: --implicit-namespaces
105
106 Without this option, :program:`sphinx-apidoc` searches :data:`sys.path`
107 for Python packages containing :file:`__init__.py` files,
108 or single-file Python modules.
109
110 This option instead uses :pep:`420` implicit namespaces that allow
111 layouts paths such as ``foo/bar/module.py`` or ``foo/bar/baz/__init__.py``
112 (note that ``bar`` and ``foo`` are namespaces, not modules).
113
114 .. option:: -M, --module-first
115
116 Put module documentation before submodule documentation.
117
118 These options are used when :option:`--full` is specified:
119
120 .. option:: -a
121
122 Append module_path to sys.path.
123
124 .. option:: -H <project>
125
126 Sets the project name to put in generated files (see :confval:`project`).
127
128 .. option:: -A <author>
129
130 Sets the author name(s) to put in generated files (see
131 :confval:`copyright`).
132
133 .. option:: -V <version>
134
135 Sets the project version to put in generated files (see :confval:`version`).
136
137 .. option:: -R <release>
138
139 Sets the project release to put in generated files (see :confval:`release`).
140
141 .. rubric:: Project templating
142
143 .. versionadded:: 2.2
144 Project templating options for sphinx-apidoc
145
146 .. option:: -t, --templatedir=TEMPLATEDIR
147
148 Template directory for template files. You can modify the templates of
149 sphinx project files generated by apidoc. Following Jinja2 template
150 files are allowed:
151
152 * ``module.rst.jinja``
153 * ``package.rst.jinja``
154 * ``toc.rst.jinja``
155 * ``root_doc.rst.jinja``
156 * ``conf.py.jinja``
157 * ``Makefile.jinja``
158 * ``Makefile.new.jinja``
159 * ``make.bat.jinja``
160 * ``make.bat.new.jinja``
161
162 In detail, please refer the system template files Sphinx provides.
163 (``sphinx/templates/apidoc`` and ``sphinx/templates/quickstart``)
164
165 Environment
166 -----------
167
168 .. envvar:: SPHINX_APIDOC_OPTIONS
169
170 A comma-separated list of option to append to generated ``automodule``
171 directives. Defaults to ``members,undoc-members,show-inheritance``.
172
173 See also
174 --------
175
176 :manpage:`sphinx-build(1)`, :manpage:`sphinx-autogen(1)`
177
178 .. _fnmatch: https://docs.python.org/3/library/fnmatch.html