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.3.tar.gz
(21.8 kB
view details)
Built Distribution
pyparam-0.2.3-py3-none-any.whl
(21.5 kB
view details)
File details
Details for the file pyparam-0.2.3.tar.gz
.
File metadata
- Download URL: pyparam-0.2.3.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5c2e57ee1e0223fe94e15cb055f603053bd5e1b5c7e63a6efd4ce21c8f7aee1 |
|
MD5 | 395943e24c67f6bda09dacbe4c2e7df0 |
|
BLAKE2b-256 | 015d4d51792eced28c39125494c2951a605dddfc4d83caab3d6ee5f6b4a9cfb5 |
File details
Details for the file pyparam-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: pyparam-0.2.3-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 951b0964aa93a606f4a812704d696301248ec3fd7ba0a5cae359230d7aea8e48 |
|
MD5 | efb50945830cb7d8e224b92559db6443 |
|
BLAKE2b-256 | 0a02d14c70382872ae74c43ca8e97ccfed4b45353dbf913c64897ab95ffb54f3 |