A package designed to simplify defaults.
Project description
cfg_param_wrapper 1.0.0
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.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 823d91da6988a5986f1f6b3c4602c1c1b3c5802eb8e9553f7749bb734f1ec49b |
|
MD5 | a7bea4c3ec5c02c21bf2fcc7d8ba2dc7 |
|
BLAKE2b-256 | 5e9961246463a832047e9e3d09b2853c22232ee0a300190702847a46ba0bfb17 |
Close
Hashes for cfg_param_wrapper-1.0.0.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f4c4527e61f0b34fab147cc7d4963cbb5875178c480c4d063dd0ed13acee571 |
|
MD5 | 9799b9fde19c2f3c52788d53cde08d4f |
|
BLAKE2b-256 | 386c1f54c7c30e7bfa3135bedf37647de6f4e7a8d41a151646d09bb91f8f55e1 |