Skip to main content

Easy YAML arguments for python scripts.

Project description

yamlarg

Easy YAML arguments for python scripts.

Usage

python3.8 -m pip install yamlarg
import yamlarg
args = yamlarg.parse('argument_file.yaml')

Example YAML arguments file.

---
string:
  help: Example string parameter.
  type: str
  default: 'default string'
bool_false:
  help: Example boolean with a default of false.
  default: False
  action: 'store_true'
bool_true:
  help: Example boolean with a default of true
  default: True
  action: 'store_false'
list:
  help: List of n number of unnamed arguments.
  default: ''
  nargs: '*'

Running a python script would then look like this.

python3.8 ./script.py --string "this is a test string" --bool_false --bool_true --list a b c
{'string': 'this is a test string', 'bool_false': True, 'bool_true': False, 'list': ['a', 'b', 'c']}

Changelog

  • Added "description" as an optional argument for the parse function.
  • Changed the description formatting to raw to allow for newlines in the description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

yamlarg-0.0.8-py2.py3-none-any.whl (6.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file yamlarg-0.0.8-py2.py3-none-any.whl.

File metadata

  • Download URL: yamlarg-0.0.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.26.0 setuptools/57.4.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.6

File hashes

Hashes for yamlarg-0.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6e25b85556b4768769cfe4715677c5e5d59bca18d4a8a417fa258d92876ea763
MD5 9b3ff7204a5956bf9eb17270d2104573
BLAKE2b-256 d5547c8e6e0087cf8530ac6a44522329a34dc114b9ab4298f3a437d5b965d74a

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