Powerful parameter processing.
Project description
pyparam
Powerful parameter processing
Features
- Command line argument parser (with subcommand support)
list/array
,dict
,positional
andverbose
options support- Type overwriting for parameters
- Rich API for Help page redefinition
- Parameter loading from configuration files
- Shell completions
Installation
pip install pyparam
# install latest version via poetry
git clone https://github.com/pwwang/pyparam.git
cd pyparam
poetry install
Basic usage
examples/basic.py
from pyparam import params
# define arguments
params.version = False
params.version.desc = 'Show the version and exit.'
params.quiet = False
params.quiet.desc = 'Silence warnings'
params.v = 0
# verbose option
params.v.type = 'verbose'
# alias
params.verbose = params.v
# list/array options
params.packages = []
params.packages.desc = 'The packages to install.'
params.depends = {}
params.depends.desc = 'The dependencies'
print(params._parse())
> python example/basic.py
> python examples/basic.py -vv --quiet \
--packages numpy pandas pyparam \
--depends.completions 0.0.1
{'h': False, 'help': False, 'H': False,
'v': 2, 'verbose': 2, 'version': False,
'V': False, 'quiet': True, 'packages': ['numpy', 'pandas', 'pyparam'],
'depends': {'completions': '0.0.1'}}
Documentation
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
pyparam-0.2.6.tar.gz
(23.5 kB
view details)
Built Distribution
pyparam-0.2.6-py3-none-any.whl
(25.2 kB
view details)
File details
Details for the file pyparam-0.2.6.tar.gz
.
File metadata
- Download URL: pyparam-0.2.6.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.7.1 Linux/4.15.0-1077-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9c2ab19441077a984e5ed95ad6d09f9118f5a0adc7ddb4ef3af7386729474d1 |
|
MD5 | 321ede3d8c585af7042a55a14293fe6e |
|
BLAKE2b-256 | 2565d21eea2c7891b4cd5abf52d3016a9daf63f80499809483c6fd1826d07ea0 |
File details
Details for the file pyparam-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: pyparam-0.2.6-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.7.1 Linux/4.15.0-1077-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 094e37cac4b49d92b5193b96e9c41406047e2809b6a58dd02c5e2f7671875310 |
|
MD5 | 9a06703a228664106d03849cf1beaa8e |
|
BLAKE2b-256 | 8290894e1e12e88c8f46bd27a82d5d54e405d0f60722269b4f5d62d67c0e7190 |