Skip to main content

The smartest command line arguments parser in the world

Project description


If you are lazy, just perform

$ pip install plac

which will install the module on your system.

If you prefer to install the full distribution from source, including the documentation, download the tarball, unpack it and run

$ python install

in the main directory, possibly as superuser.



$ python doc/

You will see several apparent errors, but this is right, since the tests are checking for several error conditions. The important thing is that you get at the a line like

Executed XX tests OK


Here is a script that does some processing on a database table:

from datetime import datetime

def main(dsn, table='product',
    "Do something on the database"
    print(dsn, table, today)

if __name__ == '__main__':
    import plac;

Here is the help message automatically generated by plac:

$ python -h
usage: [-h] dsn [table] [today]

Do something on the database

positional arguments:
  table       [product]
  today       [2019-07-28 07:18:20.054708]

optional arguments:
  -h, --help  show this help message and exit

Nevertheless to say, but plac can do a lot more, up to the creation of domain specif languages(!)


The source code and the documentation are hosted on GitHub:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for plac, version 1.1.3
Filename, size File type Python version Upload date Hashes
Filename, size plac-1.1.3-py2.py3-none-any.whl (20.9 kB) File type Wheel Python version 3.7 Upload date Hashes View
Filename, size plac-1.1.3.tar.gz (33.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page