argh
Plain Python functions as CLI commands without boilerplate
What it is and what it does
Argh is a thin wrapper around Python's built-in argparse that eliminates boilerplate by letting you write CLI commands as ordinary Python functions. Instead of constructing argument parsers manually, you define a function with type annotations and call argh.dispatch_command() to turn it into a command-line tool. Argh infers argument names, types, and help text from your function signature and annotations, making the CLI definition match the function definition.
The package is designed for developers who want the power of argparse without its verbose API. It supports subcommands, nested commands, type checking, and integrates cleanly with third-party libraries for features like completion and progress bars. Since it has no runtime dependencies beyond the standard library, it adds minimal overhead to your project.
Use it for:
- Convert a utility function into a standalone CLI tool without writing argument parser boilerplate.
- Build multi-command applications with nested subcommands while keeping command logic as plain functions.
- Create type-safe CLI tools where argument validation is driven by Python type annotations.
- Reuse the same function logic in both CLI and programmatic contexts without duplication.
- Rapidly prototype command-line interfaces for scripts, build tools, or system utilities.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Argh turns plain Python functions into command-line interfaces by wrapping argparse, inferring CLI arguments and types from function signatures and annotations.
Yes, if you need a lightweight CLI builder. Argh is stable, has no dependencies, and solves a real problem—reducing argparse boilerplate. The aging maintenance status (762 days since last release) is a minor concern for a mature, feature-complete library, but verify that it meets your Python version needs and that you're comfortable with LGPL licensing before committing to it.
Install
argh on PyPI
pip
pip install arghuv
uv add arghpoetry
poetry add arghInstalling argh
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging—last release was 762 days ago—but the repository remains active with recent commits and no archived status.
License in practice
Licensed under LGPL (copyleft). You may use and modify the package freely, but any derivative work must also be distributed under LGPL or a compatible license.
Quickstart
pip install argh
import argh
def greet(name: str, greeting: str = "Hello"):
print(f"{greeting}, {name}!")
argh.dispatch_command(greet)
Requires Python 3.8 or later.
Verify before relying
- Whether the package is actively maintained or in maintenance-only mode despite aging release cycle.
- Compatibility with modern Python versions beyond 3.13 as they are released.
Package facts
| License | not declared (copyleft) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 762 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,544,276/month — #3,008 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: argh-0.31.3-py3-none-any.whl
Keywords: cli, command line, argparse, optparse, argument, option
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
argparse-dataclassBuilds command-line interfaces declaratively by…
permissive · top 5,000 on PyPI
argparse-extExtends Python's standard argparse module with…
copyleft · top 15,000 on PyPI
faceFace is a command-line application framework…
unclear · top 1,000 on PyPI
autocommandAutocommand converts a Python function into a…
copyleft · top 5,000 on PyPI
entrypoint2Converts Python function signatures and…
permissive · top 15,000 on PyPI
decliDecli wraps argparse to let you define…
permissive · top 5,000 on PyPI
argdanticBuilds typed command-line interfaces by…
permissive · top 15,000 on PyPI
rich-argparseFormats argparse and optparse help output with…
permissive · top 1,000 on PyPI
clizeClize turns Python functions into command-line…
permissive · top 15,000 on PyPI
guacamoleGuacamole provides a framework for building…
copyleft · top 15,000 on PyPI