skillfed

argh

Plain Python functions as CLI commands without boilerplate

argh v0.31.3 2.5M downloads/30d#3,008 on PyPI382
Copyleft license AGING released

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 argh

uv

uv add argh

poetry

poetry add argh

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)Programming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: User Interfaces

Tags

cli from python functionsargparse wrappercommand line interface builderpython function to climinimal boilerplate clitype-driven argument parsing
cli-builderargparse-wrapper

More Python Modules packages