sphinx-autogen

概要

sphinx-autogen [options] <sourcefile> …

说明

sphinx-autogen is a tool for automatic generation of Sphinx sources that, using the autodoc extension, document items included in autosummary listing(s).

*sourcefile*是一个或多个reStructuredText文档的路径,该文档包含:rst:dir:autosummary 条目,并带有“:toctree::”’选项集。*sourcefile*可以遵循 :py:mod:`fnmatch`样式。

选项

-o <outputdir>

放置输出文件的目录。如果不存在,则创建一个目录。默认为传达给“:toctree:”选项的值。

-s <suffix>, --suffix <suffix>

用于生成文件的默认后缀。默认为“rst” 。

-t <templates>, --templates <templates>

自定义模板目录。默认为“None”。

-i, --imported-members

记录导入的成员。

-a, --respect-module-all

Document exactly the members in a module’s __all__ attribute.

示例

给定以下目录结构:

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-autogen docs/index.rst

然后将在“docs:”中创建以下存根文件:

docs
├── index.rst
└── modules
    ├── foobar.bar.rst
    ├── foobar.bar.baz.rst
    └── foobar.foo.rst

and each of those files will contain a autodoc directive and some other information.

另请参阅

sphinx-build(1), sphinx-apidoc(1)