SPHINX-APIDOC(1)
π sphinx-apidoc(1) β bestie edition π
okay so real talk, this is the manual page for sphinx-apidoc, part of the Sphinx docs squad (section 1 of the manual, iykyk). she's the API doc generator tool and she ATE. let's get into it π«Ά
β¨ NAME β¨
sphinx-apidoc β the Sphinx API doc generator tool. that's her. that's the whole vibe. π
πΈ SYNOPSIS πΈ
sphinx-apidoc [OPTIONS] -o <OUTPUT_PATH> <MODULE_PATH> [EXCLUDE_PATTERN ...]
π DESCRIPTION π
so basically sphinx-apidoc is that girl for automatic generation of Sphinx sources that β using the sphinx.ext.autodoc extension β documents a whole package in the style of all the other automatic API documentation tools out there. iconic behavior, no notes. β¨
MODULE_PATH is the path to a Python package to document, and OUTPUT_PATH is the directory where the generated sources get placed. any EXCLUDE_PATTERNs you hand over are fnmatch-style file and/or directory patterns (a la Python's fnmatch module, https://docs.python.org/3/library/fnmatch.html) and they get excluded from generation. bye bye, not you. π
β οΈ WARNING, bestie, listen up β οΈsphinx-apidocgenerates source files that usesphinx.ext.autodocto document all found modules. if any modules have side effects on import, those will be executed by autodoc whensphinx-buildis run. no cap, they really run. and if you're documenting scripts (as opposed to library modules), make sure their main routine is protected by aif __name__ == '__main__'condition. protect your peace (and your import) girl π«Ά
π OPTIONS π
-o <OUTPUT_PATH>β the directory to place the output files. if it doesn't exist? it gets created. she's resourceful like that. β¨-qβ do not output anything on standard output, only write warnings and errors to standard error. silent but deadly π-f,--forceβ force overwriting of any existing generated files. no survivors.-l,--follow-linksβ follow symbolic links. defaults toFalse. (we leave the links alone unless you say otherwise, respectful king/queen behavior β¨)-n,--dry-runβ do not create or remove any files. just vibes. a rehearsal, a dress rehearsal if you will π-s <suffix>β suffix for the source files generated. defaults torst.-d <MAXDEPTH>β maximum depth for the generated table of contents file. defaults to4.--tocfileβ filename for a table of contents file. defaults tomodules.-T,--no-tocβ do not create a table of contents file. ignored when--fullis provided. (sorry bestie,--fulloverrules her π)--remove-oldβ remove existing files in the output directory that are not created anymore. not compatible with--full. don't mix those, it's giving chaos π-F,--fullβ generate a full Sphinx project (conf.py,Makefileetc.) using the same mechanism assphinx-quickstart. the whole starter pack. π₯-e,--separateβ put documentation for each module on its own page. every module gets their own main character moment π
Added in version 1.2.
-E,--no-headingsβ do not create headings for the modules/packages. this is useful, for example, when docstrings already contain headings (why double up, right? π )-P,--privateβ include"_private"modules. let the private ones in, they've been waiting πΈ
Added in version 1.2.
--implicit-namespacesβ without this option,sphinx-apidocsearchessys.path(https://docs.python.org/3/library/sys.html#sys.path) for Python packages containing__init__.pyfiles, or single-file Python modules.
this option instead uses PEP 420 (https://peps.python.org/pep-0420/) implicit namespaces that allow layouts paths such as foo/bar/module.py or foo/bar/baz/__init__.py (note that bar and foo are namespaces, not modules). mind blown, honestly π€―
-M,--module-firstβ put module documentation before submodule documentation. order matters bestie β¨
π the "--full" girlies π
these options are used when --full is specified:
-aβ append module_path tosys.path.-H <project>β sets the project name to put in generated files (seeproject). π-A <author>β sets the author name(s) to put in generated files (seecopyright).-V <version>β sets the project version to put in generated files (seeversion).-R <release>β sets the project release to put in generated files (seerelease).
π¦ Project templating π¦
Added in version 2.2: Project templating options for sphinx-apidoc
-t,--templatedir=TEMPLATEDIRβ template directory for template files. you can modify the templates of sphinx project files generated by apidoc. the following Jinja2 template files are allowed:module.rst.jinjapackage.rst.jinjatoc.rst.jinjaroot_doc.rst.jinjaconf.py.jinjaMakefile.jinjaMakefile.new.jinjamake.bat.jinjamake.bat.new.jinja
in detail, please refer the system template files Sphinx provides. (sphinx/templates/apidoc and sphinx/templates/quickstart) β go peek, it's giving customization heaven π
π ENVIRONMENT π
SPHINX_APIDOC_OPTIONSβ a comma-separated list of option to append to generatedautomoduledirectives. defaults tomembers,undoc-members,show-inheritance. set it, forget it, slay π
β SEE ALSO β
sphinx-build(1), sphinx-autogen(1) β the rest of the friend group, go say hi π«Ά
π Copyright π
2007-2026, the Sphinx developers β thank you for your service, legends π
okay so that's the whole page bestie!! this beauty is version 9.1.0, dated Sep 15, 2026, and honestly? she's an icon, she's a legend, and she IS the moment. go generate some docs, you got this πΈβ¨π
sphinx-apidoc(1) β Sphinx 9.1.0, Sep 15, 2026 β periodt. π
π¦ 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