--- id: plac version: "1.4.5" license: BSD License license_treatment: permissive maintenance: active --- # plac — The smartest command line arguments parser in the world License: permissive · Maintenance: active · Downloads: 2.2M/mo ## What it is and what it does Plac is a command-line argument parser that infers CLI structure directly from Python function signatures. Instead of writing separate argument-parsing code, you decorate a function and plac automatically generates help text, validates inputs, and maps command-line arguments to function parameters. It works across Python 2.6 through modern Python 3 versions and has no external dependencies—the core functionality lives in a single module that can be embedded in your own code if needed. The package is designed for developers who want minimal boilerplate when building CLI tools. You can use simple function signatures for basic cases, or apply decorators (@plac.pos, @plac.opt, @plac.flg) for finer control over positional arguments, options, and flags. It handles variable arguments (*args, **kwds) and supports features like argument choices, type conversion, and help text generation from docstrings. Use it for: - Build a simple CLI script from a Python function without writing argparse boilerplate - Generate help and usage messages automatically from function signatures and docstrings - Create command-line tools that accept positional arguments, options, and flags with minimal decorator overhead - Embed plac_core.py directly in a package to eliminate external CLI dependencies - Prototype command-line interfaces quickly during development or data analysis workflows ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Plac generates command-line interfaces from Python function signatures, automatically handling argument parsing, help text generation, and parameter validation without external dependencies. Yes. Plac is stable, dependency-free, actively maintained, and solves a real problem—turning functions into CLIs with minimal code. It's ideal for scripts, prototypes, and tools where you want argument parsing without the verbosity of argparse. The permissive BSD license and low install friction make it a low-risk addition. Consider it if you're building CLI tools and want to keep boilerplate minimal. ## Install pip install plac uv add plac poetry add plac ## Installing plac Before you install: Low friction: pure Python wheel with no runtime dependencies beyond the standard library. Actively maintained with recent commits and stable production status. License in practice: BSD License is permissive; you can use, modify, and distribute plac freely in commercial and open-source projects with minimal restrictions. Quickstart: import plac def main(model, iter=100, debug=False): """A script for machine learning""" print(model, iter, debug) if __name__ == '__main__': plac.call(main) Verify before relying: - Whether plac's single-file design (plac_core.py) is suitable for vendoring into production codebases at scale - Performance characteristics when handling large numbers of arguments or complex nested command structures ## Package facts - License: BSD License (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 2.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags command line argument parser, CLI from function signature, automatic argument parsing, command line interface generator, argparse alternative, decorator-based CLI, zero-dependency CLI tool, cli-generation, argument-parsing, zero-dependency [View on SkillFed](https://skillfed.io/packages/plac) · [View on PyPI](https://pypi.org/project/plac/)