Metadata-Version: 2.1
Name: configprops
Version: 1.2.0
Summary: This package provides a configuration base class to be extended with list of KEYS (same prefix) that could be overridden by environment variables.
Home-page: https://github.com/tommyxu/configprops
License: MIT
Author: Xu Yijun
Author-email: xuyijun@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: PTable (>=0.9.2,<0.10.0)
Requires-Dist: python-dotenv (>=0.15.0,<0.16.0)
Project-URL: Repository, https://github.com/tommyxu/configprops
Description-Content-Type: text/markdown

# 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

```python
#!/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

```

