sphinxcontrib-autofile

readthedocs pre-commit.ci status github/workflow codecov

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

pypi/status pypi/v pypi/downloads pypi/format pypi/implementation pypi/pyversions

A sphinx extension to generate module for many files from a glob expression.

Usage

Take MyST as an example. rst is similar.

docs/conf.py:

# ...
extensions = [
    "myst_parser",
    "sphinxcontrib.autofile",
]
# ...

docs/index.md:

```{autofile} ../src/sphinxcontrib/autofile/*.py
:members:
```

It will be translated to

```{eval-rst}
.. automodule:: sphinxcontrib.autofile
    :members:

.. automodule:: sphinxcontrib.autofile.directive
    :members:

... (more modules)
```

When your modules is too many, it will save your time.

Customize

```{autofile} ../src/sphinxcontrib/autofile/*.py
:prefix: your_prefix
:template: /the/path/of/your/template
```
  • prefix: If you don’t use src-layout, change it.

  • template: template use jinja syntax. See examples.

Alternatives

See readthedocs to know more.