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.4.0.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file configprops-1.4.0.tar.gz
.
File metadata
- Download URL: configprops-1.4.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 | 4aeb5a25fec81abc5298659e445d5059b5a4adea84f3d275b64a597838228c79 |
|
MD5 | dffe8f2b121edd921df8df94a087a0da |
|
BLAKE2b-256 | 658c296ff2a650d1e38137f20ebac7c4cf4d5930d0b9c0072bfe87bbb343f932 |
File details
Details for the file configprops-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: configprops-1.4.0-py3-none-any.whl
- Upload date:
- Size: 3.1 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 | 1b1816e1a9dc0f1c755c092dfe7a6729fddd1ade83d3ec21161b839e18e4e5e4 |
|
MD5 | ccd4f45f104dd33828928825966e1e81 |
|
BLAKE2b-256 | 5e353b9cb190ee3badfe0c4359c00201cfc958e2e25d1d9ef2c88a0a03550c1d |