Utilities for building applications
Project description
Utilities for building applications.
Contains:
- Config loading from environment
- Bootstrap for logging
Examples:
import os
from datek_app_utils.env_config.base import BaseConfig
os.environ["COLOR"] = "RED"
os.environ["TEMPERATURE"] = "50"
class Config(BaseConfig):
COLOR: str
TEMPERATURE: int
assert Config.COLOR == "RED"
assert Config.TEMPERATURE == 50
The Config
class casts the values automatically.
Moreover, you can test whether all the variables have been set or not.
import os
from datek_app_utils.env_config.base import BaseConfig
from datek_app_utils.env_config.utils import validate_config
from datek_app_utils.env_config.errors import ValidationError
os.environ["COLOR"] = "RED"
class Config(BaseConfig):
COLOR: str
TEMPERATURE: int
try:
validate_config(Config)
except ValidationError as error:
for attribute_error in error.errors:
print(attribute_error)
Output:
TEMPERATURE: Not set. Required type: <class 'int'>
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
datek_app_utils-0.3.0.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for datek_app_utils-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d89de45223422e1fea211cf00c12ef9834b52e93a5082cfae28e3e38b177caa |
|
MD5 | 5b1119dad3a7fd1f796da8fa4768cbd0 |
|
BLAKE2b-256 | 96baf55be72a90eb6a28404aed8c1c69d051941ca4c5d240dbff26e15228fec0 |