Small config manager for parsing configs from different sources
Project description
config_manager
Configuration manger
Usage
Create class with config variables and inherit it from config_manager.config.Config
.
You can define variables and their types or even define values.
Then we can parse variables from different sources.
For example, this is example_parser.py:
from config_manager import config
class TestConfig(config.Config):
name: str
age: int
is_useful: bool = False
my_config = TestConfig()
config.parse_env(my_config, prefix="test_config_")
config.parse_json(my_config, json_path="test_config.json")
config.parse_arguments(my_config, "TestConfig parser")
print(my_config)
If we run it:
test_config_age=33 python example_parser.py --name hello
It will output something like and all the primitive types will be parsed correctly:
age = 33
is_useful = True
name = hello
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 config_manager_evjeny-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e1c31a1c7955f764d17aec87b9db893fed94326fb0761c434b6d1cf855ab571 |
|
MD5 | c6d9a0fb1532a35600b8d661f36de358 |
|
BLAKE2b-256 | 2aabe439d24413c795675e79a905db06fdd822692e23f3a434caeea4a021ff38 |
Close
Hashes for config_manager_evjeny-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c4cb96d2c2a82038924ad1a55b19899e61bc95226185a87143f778b90861141 |
|
MD5 | 06aa50e9c401f4113380c8eadcf8b62f |
|
BLAKE2b-256 | efe1bf3d45c93b6efd53ce4809b4a9cbc1a3d38f612a2769876179d5e47d5ce1 |