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.5.tar.gz
(23.5 kB
view details)
Built Distribution
pyparam-0.2.5-py3-none-any.whl
(25.2 kB
view details)
File details
Details for the file pyparam-0.2.5.tar.gz
.
File metadata
- Download URL: pyparam-0.2.5.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.2 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 224ba1d33743ec1bb00a1a18d83d693838e7aa95a819ba1e29fb0ce885c61243 |
|
MD5 | 5a07026844afa87ea9ddcae67b5912e5 |
|
BLAKE2b-256 | d243865b4d7bc58b78aef2e674998fc8d24fb4561ad9bc1a081f6891ddde7b0d |
File details
Details for the file pyparam-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: pyparam-0.2.5-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.2 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56915cbc81b41b616fa1eb8f4c0bf098e92d8afb92c550b9910bb1eb78f4ee25 |
|
MD5 | 59a4842005632e4a8257f4fbb6396bde |
|
BLAKE2b-256 | 2621c51f060c21cc228c3ea1922306d8b541a9069daf2bccf4de9c99e9f92225 |