A package designed to simplify configurable defaults from argparse.
Project description
cfg_argparser 1.2.1
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
cfg-argparser-1.2.1.tar.gz
(7.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cfg-argparser-1.2.1.tar.gz.
File metadata
- Download URL: cfg-argparser-1.2.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e4ca698457aa7ee378064482557975a053731761c81192c8f34d76455a775bf
|
|
| MD5 |
78c0e9ac60d3524ab12a1d444e8186e1
|
|
| BLAKE2b-256 |
6acf7dfbe96a188532e84f0fdda1bd4c0abc06f2797e76a7c06ff339a1603ed6
|
File details
Details for the file cfg_argparser-1.2.1-py3-none-any.whl.
File metadata
- Download URL: cfg_argparser-1.2.1-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35bf51ae269ebb106098d566543028fa1814cdabaeaa7f403510a48efe9d29c1
|
|
| MD5 |
b394f8c767f34283af3b577952f79faa
|
|
| BLAKE2b-256 |
c250692e7c1b4dc9170e9e726ff331e9ee219227a44fb86b00c7d4cec46cd4f1
|