Smart setting files
Project description
Smart Settings
A nifty little wrapper around settings files. Particularly useful for cluster utils.
Run to install:
python3 -m pip install al-smart-settings
Main features
-
Supports JSON, YAML and TOML files.
-
Duplicate check. Duplicate keys in JSONs are caught and raise an exception.
-
Objectification The resulting objects support dot access. By default they are immutable (but a mutable copy can be exported).
-
Imports It allows for importing other JSON files with arbitrary level of nesting and recursion. Imports are carried out from the most nested and NEVER overwrite present values.
-
Dynamic values Some values may be "computed" dynamically based on other content of the JSON (after all imports are performed). This includes access to environmental variables (present in
os.environ
).
API for changing keys in many files
python3 -m smart_settings.change_key settings/*.json train_params.opt_params optimizer_params
--> Changes train_params.opt_params
to train_params.optimizer_params
in every file matching the wildcard
python3 -m smart_settings.add_key settings/*.json train_params.num_epochs 10 --override
--> Adds key train_params.num_epochs
with value 10
. --override
controls overwriting of present values
python3 -m smart_settings.port_cluster_utils_3 settings/**/*.json
--> Performs all name changes required for porting to cluster_utils >=3.0
Examples
See the examples
folder
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
File details
Details for the file al_smart_settings-1.2.0.tar.gz
.
File metadata
- Download URL: al_smart_settings-1.2.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a9d3dfc3d8bb228191d1e119f81bd099acf105ca153ec63a0da6ffade35e317 |
|
MD5 | fd09a61cd579b8a5a06922ebf41fcdf9 |
|
BLAKE2b-256 | dea64e44991ecfee816ec84e4c0e42deefb6a614a54db9bce0ce8089ebc71780 |
File details
Details for the file al_smart_settings-1.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: al_smart_settings-1.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c98e69817aa73455ee52c01fecf4a58f81d8ea2cc1244e784236102413952155 |
|
MD5 | 45daa2c88c4f6c9a222c3f226cfa92ba |
|
BLAKE2b-256 | 061443a6aaf7c63a7fe6d6b7ba6511fa9bb51999a726a18213678c3175a88892 |