skillfed

docopt

Pythonic argument parser, that will make you smile

docopt v0.6.2 18.7M downloads/30d#1,080 on PyPI
Permissive license MIT Abandoned released

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 docopt

uv

uv add docopt

poetry

poetry add docopt

Installing 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

Development Status :: 3 - AlphaLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2.5Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Topic :: Utilities

Tags

command-line argument parsingdocstring-based CLI parsergenerate argument parser from help textsimple command-line interfaceoption and argument parsingCLI argument handlingdocopt-style argument parsing
cli-parsingabandoned

More Utilities packages