SPHINX-AUTOGEN(1)
β¨ SPHINX-AUTOGEN(1) β¨
okay so bestie, this is the manual page for sphinx-autogen, part of the Sphinx docs toolkit π
let's get into it
πΈ NAME πΈ
sphinx-autogen β generates autodoc stub pages, no cap π
π SYNOPSIS π
sphinx-autogen [options] <sourcefile> ...
π¦ DESCRIPTION π¦
So sphinx-autogen is this little tool that automatically generates Sphinx sources for you β¨ β the kind that, using the autodoc extension, document items that show up in autosummary listing(s). Basically it writes the boring repetitive stub files so you don't have to, and honestly? iconic behaviour.
sourcefile is the path to one or more reStructuredText documents that contain autosummary entries with the :toctree: option set. And here's the cute part β sourcefile can be an fnmatch-style pattern π so you can wildcard-match your way through a whole folder, periodt.
π OPTIONS π
-o<outputdir> β the directory where the output file goes. If it doesn't exist yet, it gets created (slay, it just handles that). Defaults to whatever value you passed to the:toctree:option β¨-s<suffix>,--suffix<suffix> β the default suffix used for the generated files. Defaults torstπ-t<templates>,--templates<templates> β custom template directory, for when you wanna make it yours. Defaults toNoneπ¦-i,--imported-membersβ documents imported members too, not just the homegrown ones π-a,--respect-module-allβ documents exactly the members sitting in a module's__all__attribute. No extras, no strays, only the chosen ones π--remove-oldβ removes existing files in the output directory that aren't generated anymore. Spring cleaning but make it automated π§Ήβ¨
π EXAMPLE π
okay imagine bestie, you've got this directory structure going on:
docs
βββ index.rst
βββ ...
foobar
βββ foo
β βββ __init__.py
βββ bar
βββ __init__.py
βββ baz
βββ __init__.py
and let's say docs/index.rst contained this:
Modules
=======
.. autosummary::
:toctree: modules
foobar.foo
foobar.bar
foobar.bar.baz
now if you run this:
$ PYTHONPATH=. sphinx-autogen docs/index.rst
then these stub files get created in docs π:
docs
βββ index.rst
βββ modules
βββ foobar.bar.rst
βββ foobar.bar.baz.rst
βββ foobar.foo.rst
and every single one of those files will contain an autodoc directive plus some other information π the way it just does that for you? obsessed.
π SEE ALSO π
π Copyright π
2007-2026, the Sphinx developers π«Ά
and that's the whole vibe bestie β this was sphinx-autogen version 9.1.0, dated Sep 15, 2026, brought to you by the Sphinx girlies πΈ mwah, go generate some stubs π
β¨
π¦ where this page comes from
- ubuntu stonking: sphinx-common 9.1.0-8 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms