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']}
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
Close
Hashes for yamlarg-0.0.7-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6a829d49411cea7ddcda790f4af7c4da10e491bbe0e09d4028876772109e44d |
|
MD5 | 55281c5d414cd9d19ce2bcd6f2645bf8 |
|
BLAKE2b-256 | 6147ba1bccf8cbc13a876e61c0660950f26c15191271a68c35d4a334f26aa2e5 |