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.1.8.tar.gz
(21.5 kB
view details)
Built Distribution
pyparam-0.1.8-py3-none-any.whl
(21.2 kB
view details)
File details
Details for the file pyparam-0.1.8.tar.gz
.
File metadata
- Download URL: pyparam-0.1.8.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd94230827b05998fe3ef6e6c85eb2082c218259f27013410934a66d00a24162 |
|
MD5 | d7d3fb19287c3303072d93a8888770f3 |
|
BLAKE2b-256 | a691ee0b0159955bdb72ed54e107c4e43d45dab0aeefd34e5bd82f6d9a1ac22d |
File details
Details for the file pyparam-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: pyparam-0.1.8-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f682f7e81764cb8061cbc0121f3bd61000acbbfccb79bdcd86b7b7e11bdb538f |
|
MD5 | a7b345a1e3daa2554995a66a5175d441 |
|
BLAKE2b-256 | c59334da08a9ea5db79814157e88232afe06839afb8ece8ee43c20bbd9cf71b5 |