autocommand
A library to create a command-line program from a function
What it is and what it does
Autocommand is a decorator-based library that turns a Python function into a fully functional command-line program. It inspects the function's signature—parameters, type annotations, and defaults—and automatically builds an argparse parser that handles positional arguments, optional flags, type conversion, and help text. When the module is run as __main__, autocommand collects command-line arguments, validates them against the function signature, and executes the function with the parsed values.
The library handles common CLI patterns: trailing arguments via *args, boolean switches with automatic short flags, type coercion with validation, file arguments, and docstring-based help text. It eliminates boilerplate argparse setup for simple scripts, making it useful for quick command-line tools, utility scripts, and small applications where a full framework would be overkill.
Use it for:
- Convert a utility function into a standalone script without writing argparse boilerplate.
- Build simple command-line tools that accept typed arguments with automatic validation and help.
- Create file processing scripts (cat, copy, filter) that read from stdin or file paths.
- Prototype CLI applications where function signatures naturally map to command arguments.
- Add command-line interfaces to existing Python functions with minimal code changes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Autocommand converts a Python function into a command-line program by automatically generating an argparse parser from the function's signature, handling arguments, options, type conversion, and help text generation.
Yes, for simple scripts and utilities. Autocommand is mature, dependency-free, and solves a real problem—eliminating argparse boilerplate for straightforward CLI functions. Dormant maintenance is not a blocker for stable, feature-complete code, but consider it only for scripts where the function-to-CLI mapping is natural. For complex CLIs, subcommands, or plugins, use a more actively maintained framework.
Install
autocommand on PyPI
pip
pip install autocommanduv
uv add autocommandpoetry
poetry add autocommandInstalling autocommand
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is dormant—last release was 2022-11-18 and last commit 2024-04-04—but the package is marked Mature and has been stable since its 2015 release.
License in practice
Licensed under LGPLv3 (copyleft). Any derivative work or modification must be released under compatible terms; static linking or bundling may trigger copyleft obligations depending on how the package is integrated.
Quickstart
from autocommand import autocommand
@autocommand(__name__)
def echo(thing):
print(thing)
# Run: python script.py hello
Requires Python 3.7 or later.
Verify before relying
- Whether the package works correctly with Python versions beyond 3.7 despite no recent releases.
- Whether dormant maintenance status affects real-world reliability for new projects.
Package facts
| License | LGPLv3 (copyleft) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,365 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,475,808/month — #3,862 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: autocommand-2.2.2-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
placPlac generates command-line interfaces from…
permissive · top 5,000 on PyPI
arguablyConverts Python functions and their docstrings…
unclear · top 15,000 on PyPI
arghArgh turns plain Python functions into…
copyleft · top 5,000 on PyPI
pyctProvides command-line and Python utilities for…
permissive · top 15,000 on PyPI
entrypoint2Converts Python function signatures and…
permissive · top 15,000 on PyPI
mandomando wraps argparse to let you build…
permissive · top 5,000 on PyPI
clizeClize turns Python functions into command-line…
permissive · top 15,000 on PyPI
pydantic-argparseGenerates command-line argument parsers from…
permissive · top 5,000 on PyPI
python-tools-scriptsBuilds CLI tools by auto-discovering Python…
permissive · top 15,000 on PyPI
decliDecli wraps argparse to let you define…
permissive · top 5,000 on PyPI