The smartest command line arguments parser in the world
Project description
Installation
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 setup.py install
in the main directory, possibly as superuser.
Testing
Run
$ python doc/test_plac.py
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
Quickstart
Here is a script that does some processing on a database table:
# updatedb.py
from datetime import datetime
def main(dsn, table='product', today=datetime.today()):
"Do something on the database"
print(dsn, table, today)
if __name__ == '__main__':
import plac; plac.call(main)
Here is the help message automatically generated by plac:
$ python updatedb.py -h usage: updatedb.py [-h] dsn [table] [today] Do something on the database positional arguments: dsn 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(!)
Documentation
The source code and the documentation are hosted on GitHub. Here is the full documentation in both HTML and PDF formats:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file plac-1.1.0.tar.gz
.
File metadata
- Download URL: plac-1.1.0.tar.gz
- Upload date:
- Size: 123.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c16cfa7422a76b7525fc93d0be5c9c9a2d5250083e80ddac6621edb395dc081 |
|
MD5 | b8a0df16e895c60658acb661cf82c0b0 |
|
BLAKE2b-256 | 14c934448200c3dd247fc7b266f19c8437b1f3ee9187cfe0940e05c19813edf9 |
File details
Details for the file plac-1.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: plac-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee0e529ae5f8104914e53b79a46d5687dcfc94b49deb6aed2665f40b2e4f0536 |
|
MD5 | 2946baba219054d14c2d71ba9fe2dee4 |
|
BLAKE2b-256 | d62d06ad623272c7b38324e362d606a685ca051be28b5eaac3897eb120bfe70c |