--- id: autocommand version: "2.2.2" license: LGPLv3 license_treatment: copyleft maintenance: dormant --- # autocommand — A library to create a command-line program from a function License: copyleft · Maintenance: dormant · Downloads: 1.5M/mo ## 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 above — 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 pip install autocommand uv add autocommand poetry add autocommand ## Installing 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_current - Install friction: low - Maintenance: dormant - Downloads: 1.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags function to command line, argparse from function signature, automatic cli generator, python function as script, decorator command line tool, cli argument parser, function signature to args, cli-generation, argparse-wrapper, script-automation [View on SkillFed](https://skillfed.io/packages/autocommand) · [View on PyPI](https://pypi.org/project/autocommand/)