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.1.0.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file configprops-1.1.0.tar.gz
.
File metadata
- Download URL: configprops-1.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.5 Darwin/19.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 584114afdd7316413a4e18c22e671ccf2ae1d44c7030a91279067d1e4e881ec9 |
|
MD5 | 54db8fd18b57f177a91d012d9da44968 |
|
BLAKE2b-256 | 318b8a3c23a791c7bcb06eefe2289162ab377cd369fb60a41fd38af299054b91 |
File details
Details for the file configprops-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: configprops-1.1.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.5 Darwin/19.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 891defb6bc31af7a82d4144ecefe9cbf02ce2f568de4cc12cd85a13af51fd1e7 |
|
MD5 | 1788f6bcbc21f775feb7f17c3e1f12cc |
|
BLAKE2b-256 | 6f20e534349579c3c06bb8f6cd8f404f1cde6ff9f2cfe22f47d7040992269bbf |