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 details)
Built Distribution
File details
Details for the file configprops-1.2.0.tar.gz
.
File metadata
- Download URL: configprops-1.2.0.tar.gz
- Upload date:
- Size: 3.1 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 | 9b61a8999deb7bc181d7520d58c01eea63cc656b4841998e0c03f5fc92294657 |
|
MD5 | bf0fa3fa2c5e02ddb163c3ab58f1f7ef |
|
BLAKE2b-256 | abcbf80bd87a41c8ed0a91523a6446a0a773d3cc9ab0804bbf77d07ea304506d |
File details
Details for the file configprops-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: configprops-1.2.0-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 | f3ef6bd2b5111191d209f921eb44732c85b78c383a6250b0bb70f8e82035c1be |
|
MD5 | 3cf809707df4a5b121d73feee02cb447 |
|
BLAKE2b-256 | ade646b8d13ce11701dd69f8c0f1be2998ac6b9d78b911c4f69ce997e4563429 |