plac
The smartest command line arguments parser in the world
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 on this page — 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
plac on PyPI
pip
pip install placuv
uv add placpoetry
poetry add placInstalling 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 | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 497 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,178,574/month — #3,229 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: plac-1.4.5-py2.py3-none-any.whl
Keywords: command, line, arguments, parser
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
autocommandAutocommand converts a Python function into a…
copyleft · top 5,000 on PyPI
pydantic-argparseGenerates command-line argument parsers from…
permissive · top 5,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
decliDecli wraps argparse to let you define…
permissive · top 5,000 on PyPI
parameter-decoratorsProvides decorators that automatically convert…
copyleft · top 15,000 on PyPI
argparseProvides command-line argument parsing for…
permissive · top 1,000 on PyPI
typed-argument-parserA typed, modern replacement for Python's…
permissive · top 15,000 on PyPI
argparse-dataclassBuilds command-line interfaces declaratively by…
permissive · top 5,000 on PyPI
clizeClize turns Python functions into command-line…
permissive · top 15,000 on PyPI