skillfed

plac

The smartest command line arguments parser in the world

plac v1.4.5 2.2M downloads/30d#3,229 on PyPI303
Permissive license BSD License Active released

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 plac

uv

uv add plac

poetry

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 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: LibrariesTopic :: Utilities

Tags

command line argument parserCLI from function signatureautomatic argument parsingcommand line interface generatorargparse alternativedecorator-based CLIzero-dependency CLI tool
cli-generationargument-parsingzero-dependency

More Libraries packages