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.5.tar.gz
(20.8 kB
view details)
Built Distribution
pyparam-0.1.5-py3-none-any.whl
(20.5 kB
view details)
File details
Details for the file pyparam-0.1.5.tar.gz
.
File metadata
- Download URL: pyparam-0.1.5.tar.gz
- Upload date:
- Size: 20.8 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 | 6862db1d6a0e331f27dd8b32f3c12814bf164b61429271c6ffa3955d325b5854 |
|
MD5 | cd8659e3bd7e2204f32c28f835c6040b |
|
BLAKE2b-256 | 55ea62841fdc7b5d0e74e83da8bd40322912c9e88187e993b2a42b726eb6a2d3 |
File details
Details for the file pyparam-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: pyparam-0.1.5-py3-none-any.whl
- Upload date:
- Size: 20.5 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 | 989f840982adcc32cfea6d78bbc678489ab167a460a4e99d450a510804f8771a |
|
MD5 | 0046de5110c4bf0f69e26f8378d4cf80 |
|
BLAKE2b-256 | 105b197c9947615ff334120e0dad4d4d9240019fdd64dc42bc3f004e68ff9405 |