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.0.1.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file configprops-1.0.1.tar.gz
.
File metadata
- Download URL: configprops-1.0.1.tar.gz
- Upload date:
- Size: 2.9 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 | 7d3370f3f13293c7c904599658c943a78709c5b6bb90b01a7e9f1d45c1677ce2 |
|
MD5 | 1dd68f4eecb5af480483da69f7933917 |
|
BLAKE2b-256 | e7c5351f86caaeea82b47c4bce6e41b1fab9c74cc7b37536adb8e7fdf6b0414e |
File details
Details for the file configprops-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: configprops-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 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 | c362d514c27a8a05b46e43bb0f66c9096daca89d7c751fb8e66b843e9ad82a07 |
|
MD5 | 8b0c9f0cec177be469477644e1b88de8 |
|
BLAKE2b-256 | f53f51ca06eafcff9b5c5358028b89b0138907b3454b5aec190ca6f6d253541d |