Skip to main content

Powerful parameter processing.

Project description

pyparam

pypi pypi travis docs codacy quality codacy quality pyver

Powerful parameter processing

Features

  • Command line argument parser (with subcommand support)
  • list/array, dict, positional and verbose 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

help

> 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

ReadTheDocs

Project details


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.4.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

pyparam-0.2.4-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file pyparam-0.2.4.tar.gz.

File metadata

  • Download URL: pyparam-0.2.4.tar.gz
  • Upload date:
  • Size: 22.1 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

Hashes for pyparam-0.2.4.tar.gz
Algorithm Hash digest
SHA256 1abb40b5b4a08212dae29a2ddae1031c818f6eca58d5f420be97e989eff00001
MD5 086b105e4404490f47b19e3300b246d6
BLAKE2b-256 c3e9097e3c3bce18d165d42c0e11ad09a912ef7d1b553497aa3932a8221ca944

See more details on using hashes here.

File details

Details for the file pyparam-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: pyparam-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 21.7 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

Hashes for pyparam-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 73d52b0fd4cd57113a5ec0d8b6dd7cdc8bfb20e6b48d779ff273da54e9644bbf
MD5 2a0c6aa4bb996fecdee6aad3f13408b5
BLAKE2b-256 4139d01e7ece4133e590fa8d47d274ebe7e145694f8b38348f081f33e4165dc5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page