skillfed

docopt-ng

Jazzband-maintained fork of docopt, the humane command line arguments parser.

docopt-ng v0.9.0 1.8M downloads/30d#3,517 on PyPI223
Permissive license MIT Active released

What it is and what it does

docopt-ng is a command-line argument parser that derives its parsing rules directly from a help message written in your code's docstring. Instead of defining arguments separately via decorators or configuration objects, you write a usage pattern and option descriptions in plain text, and docopt-ng parses them to validate and extract command-line arguments. It returns a simple dictionary mapping option names, arguments, and commands to their parsed values.

The package is a maintained fork of the original docopt, now under jazzband stewardship with type hints and full test coverage. It supports Python 3.7 and later, has no runtime dependencies, and works with both CPython and PyPy. The approach trades some flexibility for simplicity: if your help message is well-formed, the parser is automatically correct, and your documentation and argument handling stay synchronized.

Use it for:

  • Build a simple CLI tool where the help message is the source of truth for argument parsing.
  • Add argument parsing to a script without introducing a heavy dependency like argparse or Click.
  • Generate a command-line interface for a utility where the usage pattern is already documented.
  • Parse subcommands and options in a tool that dispatches to other programs or modules.
  • Prototype or maintain a CLI where keeping help text and code in sync is a priority.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses command-line arguments and options from a docstring-based usage pattern, returning a dictionary of parsed arguments without requiring separate argument definitions.

Yes. docopt-ng is a lightweight, actively maintained parser with zero runtime dependencies, permissive licensing, and no known vulnerabilities. Install it if you prefer defining CLI arguments via docstring conventions and want a minimal dependency footprint. Skip it if you need advanced features like type coercion, nested subcommands, or rich help formatting—argparse or Click are better fits for those cases.

Install

docopt-ng on PyPI

pip

pip install docopt-ng

uv

uv add docopt-ng

poetry

poetry add docopt-ng

Installing docopt-ng

Before you install

Low friction—a pure Python wheel with no runtime dependencies. Actively maintained by jazzband since its fork, with recent commits and complete test coverage.

License in practice

MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal attribution requirements.

Quickstart

from docopt import docopt

doc = """Usage: prog.py [--verbose] FILE

Options:
  --verbose  Enable verbose output.
"""

args = docopt(doc, ['--verbose', 'input.txt'])
print(args)

Requires Python 3.7 or later.

Verify before relying

  • Performance characteristics with large or complex usage patterns.
  • Compatibility with non-ASCII characters in argument names or help text.
  • Behavior when docstring format deviates from documented conventions.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 1,172 days since the last release
Last repo commit
First released
Downloads 1,822,308/month — #3,517 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: docopt_ng-0.9.0-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

command line argument parserdocstring-based CLI parserparse command line optionsCLI interface from docstringargument parsing from help textcommand line interface generatordocopt parser
cli-parsingdocstring-driven

More Utilities packages