A package designed to simplify configurable defaults from argparse.
Project description
cfg_argparser 1.2.0
a config wrapper I made.
Installation
# from pypi:
pip install cfg-argparser
# from github:
git clone "https://github.com/zeptofine/cfg-argparser"
cd cfg-argparser
pip install -e .
Example
from cfg_argparser import wrap_config, CfgDict
cfg = CfgDict("test.json")
@wrap_config(cfg)
def test_function(s: str, is_real: bool = True): # I'd advise only wrapping functions all having default methods
return f"{s} is {'real' if is_real else 'fake'}"
if __name__ == "__main__":
print(test_function("We"))
cfg['s'] = "us"
print(test_function()) # Linters hate him!
Compatibilty
This was mainly tested on 3.9 and 3.10, but it should work from 3.6 onwards. i can't test earlier versions for some reason.
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
Built Distribution
Close
Hashes for cfg-argparser-1.2.0.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72d31bae84253caddbcee54174833fc81b79cd8f14983d358c3c08420d7a2192 |
|
MD5 | 7c7131360d541284dce29de7e9d4e82f |
|
BLAKE2b-256 | 698396aa957b04e7ed01ceda08ca05ca2eaecbaaeb12e30192b69110f543f03c |
Close
Hashes for cfg_argparser-1.2.0.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24a1af2f9485cf8096c0000aa644a6208c0701b15cb12cded85fb23365c6e377 |
|
MD5 | c637cd495f04087adb21e7da905e0791 |
|
BLAKE2b-256 | 58cbe81fa50153c761d68e4ca686edd58c581e1a14d553e87c4a6285fe87445c |