sphinx-autogen¶
概要¶
sphinx-autogen [options] <sourcefile> …
描述¶
sphinx-autogen 是一个自动生成Sphinx源的工具,使用 autodoc 扩展,文档项包含在 autosummary listing(s)中。
sourcefile is the path to one or more reStructuredText documents containing
autosummary entries with the :toctree:: option set. sourcefile
can be an fnmatch-style pattern.
选项¶
-
-o<outputdir>¶ 放置输出文件的目录。如果它不存在,则创建它。默认为传递给
:toctree:选项的值。
-
-s<suffix>,--suffix<suffix>¶ 用于生成文件的默认后缀。默认为
rst。
-
-t<templates>,--templates<templates>¶ 自定义模板目录。默认为
None。
-
-i,--imported-members¶ 记录导入的成员。
例¶
给定以下目录结构:
docs
├── index.rst
└── ...
foobar
├── foo
│ └── __init__.py
└── bar
├── __init__.py
└── baz
└── __init__.py
并假设 docs/index.rst 包含以下内容:
Modules
=======
.. autosummary::
:toctree: modules
foobar.foo
foobar.bar
foobar.bar.baz
如果您运行以下内容:
$ PYTHONPATH=. sphinx-autodoc doc/index.rst
然后将在 docs: 中创建以下存根文件:
docs
├── index.rst
└── modules
├── foobar.bar.rst
├── foobar.bar.baz.rst
└── foobar.foo.rst
每个文件都包含一个 autodoc 指令和其他一些信息。
也可以看看¶
sphinx-build(1), sphinx-apidoc(1)