A package designed to simplify defaults.
Project description
cfg_param_wrapper 1.0.0-2
a config wrapper I made. It's made to wrap simple functions, and intercept configurations in tandem with a CfgDict object.
Installation
# from pypi:
pip install cfg-param-wrapper
# from github:
git clone "https://github.com/zeptofine/cfg-param-wrapper"
cd cfg-param-wrapper
pip install -e .
Example
from cfg_param_wrapper 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!
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-param-wrapper-1.0.0.post2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a65f1a6fdaed534dcffb4dc3972183758190b318c53b8da5d53839efcc0a67a |
|
MD5 | cde811f069aa915eebd9fcf383909772 |
|
BLAKE2b-256 | 0acf6eb6309e6699c7578bf00f3d6de388212b5d9e2d8246effbfe51f18b1c8c |
Close
Hashes for cfg_param_wrapper-1.0.0.post2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 686c1f130d8709f3125a4aef7f8bdb7dd09afdb4273c320d443865f8de32f96f |
|
MD5 | 4e35d28103caf5fc937722e955d72593 |
|
BLAKE2b-256 | 5e2ebf4930004907205eedfc598191dde09971af02c40556b56efe1b3f64d4c0 |