sphinx-argparse
A sphinx extension that automatically documents argparse commands and options
What it is and what it does
sphinx-argparse is a Sphinx extension that bridges the gap between argparse-based command-line tools and their documentation. Instead of manually writing out every argument, option, and subcommand in your docs, you point the extension at your argparse parser object and it automatically generates formatted documentation from the parser's structure. It integrates directly into the Sphinx build process via a custom directive.
The extension depends on sphinx and docutils to render the generated documentation into your final HTML, PDF, or other Sphinx output formats. It's maintained as part of the official Sphinx documentation tooling ecosystem and supports modern Python versions (3.10 through 3.13, including PyPy).
Use it for:
- Auto-generate CLI reference documentation from an existing argparse parser without duplicating argument descriptions.
- Keep command-line help text and Sphinx docs in sync by sourcing both from the same parser definition.
- Document complex CLI tools with subcommands and nested argument groups in a structured, searchable format.
- Build API documentation sites that include both Python API and CLI interface reference in one place.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Sphinx extension that automatically generates documentation for argparse command-line interfaces by introspecting their argument definitions.
Yes. Low install friction, active maintenance, no known vulnerabilities, permissive MIT license, and a focused purpose that solves a real documentation problem for CLI tools. Install if you use argparse and Sphinx together; skip if you don't use Sphinx or prefer manual CLI documentation.
Install
sphinx-argparse on PyPI
pip
pip install sphinx-argparseuv
uv add sphinx-argparsepoetry
poetry add sphinx-argparseInstalling sphinx-argparse
Before you install
Low friction install with only sphinx and docutils as runtime dependencies. Active maintenance with recent release (44 days ago) and continuous repository activity.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects.
Quickstart
pip install sphinx-argparse
In conf.py:
extensions = ['sphinx_argparse.ext']
In your .rst file:
.. argparse::
:module: mymodule
:func: create_parser
Requires Python 3.10 or later; your project must use Sphinx and have argparse-based CLI code to document.
Verify before relying
- Whether the extension handles complex argparse patterns (subparsers, custom actions, mutually exclusive groups) beyond basic commands.
- Performance characteristics when documenting very large or deeply nested argument hierarchies.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — sphinx, docutils |
| Maintenance | actively maintained — 44 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,255,443/month — #2,347 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sphinx_argparse-0.6.0-py3-none-any.whl
Tags
More Documentation packages
Docutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
SphinxSphinx generates professional documentation…
permissive · top 1,000 on PyPI
griffeGriffe extracts the complete structure and…
permissive · top 1,000 on PyPI
sphinxcontrib-serializinghtmlA Sphinx extension that outputs documentation…
permissive · top 1,000 on PyPI
alabasterAlabaster is a clean, responsive Sphinx theme…
permissive · top 1,000 on PyPI
sphinxcontrib-htmlhelpA Sphinx extension that generates HTML help…
permissive · top 1,000 on PyPI
linuxdocSphinx-doc extensions and command-line tools…
agpl · top 15,000 on PyPI
sphinxcontrib-devhelpA Sphinx extension that generates Devhelp…
permissive · top 1,000 on PyPI
sphinx-automodapiSphinx extension that automatically generates…
permissive · top 15,000 on PyPI
sphinxcontrib-qthelpA Sphinx extension that converts documentation…
permissive · top 1,000 on PyPI
sphinxcontrib-autoyamlA Sphinx extension that auto-generates…
permissive · top 15,000 on PyPI
python-tools-scriptsBuilds CLI tools by auto-discovering Python…
permissive · top 15,000 on PyPI
sphinx-autosummary-accessorsA Sphinx extension that generates proper…
permissive · top 15,000 on PyPI
argparse-extExtends Python's standard argparse module with…
copyleft · top 15,000 on PyPI
dargsValidates, normalizes, and documents structured…
copyleft · top 15,000 on PyPI