skillfed

sphinx-argparse

A sphinx extension that automatically documents argparse commands and options

sphinx-argparse v0.6.0 4.3M downloads/30d#2,347 on PyPI38
Permissive license MIT Active released

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-argparse

uv

uv add sphinx-argparse

poetry

poetry add sphinx-argparse

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleFramework :: SphinxFramework :: Sphinx :: ExtensionOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: DocumentationTopic :: Documentation :: Sphinx

Tags

sphinx argparse documentationauto-document cli argumentsargparse sphinx extensioncommand line help documentationgenerate cli docs from argparse
sphinx-extensioncli-documentationargparse

More Documentation packages