This package provides a configuration base class to be extended with list of KEYS (same prefix) that could be overridden by environment variables.
Project description
configprops
Introduction
This package provides a configuration base class to be extended with list of KEYS (same prefix) that could be overridden by environment variables."
Examples
#!/usr/bin/env python3
from configprops import ConfigurationProperties
import os
class AppTestConfig(ConfigurationProperties):
TEST_APP_CONFIG_KEY_TEXT = 'Original'
TEST_APP_CONFIG_KEY_BOOL = True
TEST_APP_CONFIG_KEY_INT = 32
TEST_APP_CONFIG_KEY_FLOAT = 3.3
TEST_APP_CONFIG_KEY_OTHER = 55
def test_override():
os.environ['TEST_APP_CONFIG_KEY_BOOL'] = '0'
os.environ['TEST_APP_CONFIG_KEY_FLOAT'] = '8.5'
os.environ['TEST_APP_CONFIG_KEY_INT'] = '185'
config = AppTestConfig('TEST_APP_CONFIG_')
assert config.TEST_APP_CONFIG_KEY_BOOL == False
assert config.TEST_APP_CONFIG_KEY_OTHER == 55
assert config.TEST_APP_CONFIG_KEY_FLOAT == 8.5
assert config.TEST_APP_CONFIG_KEY_INT == 185
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
configprops-1.2.0.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for configprops-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3ef6bd2b5111191d209f921eb44732c85b78c383a6250b0bb70f8e82035c1be |
|
MD5 | 3cf809707df4a5b121d73feee02cb447 |
|
BLAKE2b-256 | ade646b8d13ce11701dd69f8c0f1be2998ac6b9d78b911c4f69ce997e4563429 |