docopt
Pythonic argument parser, that will make you smile
What it is and what it does
docopt is a command-line argument parser that inverts the typical workflow: instead of writing parser code to match your help message, you write a clean help message in your module docstring and docopt generates the parser from it. It parses the usage pattern and option descriptions from your docstring, validates command invocations against that pattern, and returns a dictionary of parsed arguments and options.
The package has no runtime dependencies and is small enough to embed directly in a project. However, it is abandoned—the last release was 2014-06-16 and was only tested on Python 2.5, 2.6, 2.7, 3.2, and 3.3. While it may still work on modern Python, there is no active maintenance, no bug fixes, and no forward compatibility guarantees.
Use it for:
- Build a simple CLI tool where the help message is your single source of truth for argument parsing.
- Quickly prototype a command-line utility without writing boilerplate argument-parsing code.
- Create a CLI with multiple exclusive command patterns (e.g., different subcommands with different options).
- Add argument parsing to a small script without introducing a heavy dependency.
- Parse custom argument vectors for testing or programmatic CLI invocation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses command-line arguments based on a help message docstring, generating an argument parser without writing repetitive parser code.
No—do not install for new projects. The package is abandoned with no maintenance since 2014-06-16 and was only tested on Python 2.5, 2.6, 2.7, 3.2, and 3.3. Install only if you are maintaining legacy code that already depends on docopt 0.6.2 and cannot be migrated.
Install
docopt on PyPI
pip
pip install docoptuv
uv add docoptpoetry
poetry add docoptInstalling docopt
Before you install
High install friction: the package is abandoned (last release 2014-06-16, 4442 days ago) with no active maintenance. It has zero runtime dependencies, making installation itself straightforward, but the lack of ongoing support poses a long-term risk for bug fixes or compatibility updates.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install docopt==0.6.2
from docopt import docopt
if __name__ == '__main__':
doc = """Usage: prog [-h] [--verbose]
Options:
-h --help Show this screen.
--verbose Verbose output.
"""
arguments = docopt(doc)
print(arguments)
Package is abandoned; no updates since 2014. Compatibility with modern Python versions is untested and unsupported.
Verify before relying
- Whether the package actually works on Python versions beyond 3.3 despite lack of testing or maintenance.
- Whether any known issues or edge cases have emerged since last release that would affect current use.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 4,442 days since the last release |
| First released | |
| Downloads | 18,662,111/month — #1,080 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: docopt-0.6.2.tar.gz
Keywords: option, arguments, parsing, optparse, argparse, getopt
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
argparseProvides command-line argument parsing for…
permissive · top 1,000 on PyPI
docopt-ngParses command-line arguments and options from…
permissive · top 5,000 on PyPI
targGenerates a command-line interface from…
permissive · top 15,000 on PyPI
autocommandAutocommand converts a Python function into a…
copyleft · top 5,000 on PyPI
argparse-dataclassBuilds command-line interfaces declaratively by…
permissive · top 5,000 on PyPI
rich-argparseFormats argparse and optparse help output with…
permissive · top 1,000 on PyPI
cleoCleo builds command-line interfaces with…
permissive · top 1,000 on PyPI
flyntFlynt is a command-line tool that automatically…
permissive · top 15,000 on PyPI
entrypoint2Converts Python function signatures and…
permissive · top 15,000 on PyPI
argparse-extExtends Python's standard argparse module with…
copyleft · top 15,000 on PyPI