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.1.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file configprops-1.2.1.tar.gz
.
File metadata
- Download URL: configprops-1.2.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.9.2 Darwin/20.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24bce48a25a82e6b61bc3d82119f47157e0218b63bdbdaf35bed4e1fde580019 |
|
MD5 | a3de8049f0081060ad5b0daa74e218b8 |
|
BLAKE2b-256 | dcb9465f74f4213417920e20fd4f3534e9ceb2c2d7d0c73e5af6ecd0c227c813 |
File details
Details for the file configprops-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: configprops-1.2.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.9.2 Darwin/20.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 137343a9adb59d1157cc53c151ecd66dc79f825044d0de9563901470abcf2346 |
|
MD5 | cf245ff7d05f3e1b0899e3f1f01fb305 |
|
BLAKE2b-256 | b5914f53fb683801634c31df896d0bd22d6e9ce3fb91768e77c289813640537d |