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 to rst πŸŽ€
  • -t <templates>, --templates <templates> β€” custom template directory, for when you wanna make it yours. Defaults to None πŸ¦‹
  • -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 πŸ‘€


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