Skip to main content

Python config lib for loading application configurations

Project description

Python configoo

A simple library for loading application configurations from files, environments and etc. Configuration variables declares in ORM model class maner to make it easier to use config variables in code with IDE syntax highlights.

Setup

TODO: write it

Example

# config.py

from configoo import Model, field, load_from_env

class Config(Model):
    """A simple configuration model.

    FOO - an integer value (default value is 123)
    BAR - a string value (must be specified in config source, otherwise the exception about missed field value will be thrown)
    """

    FOO = field.Integer(default=123)
    BAR = field.List(field.String(), required=True)

# Load `Config` field from process environment.
config = load_from_env(Config)


# test.py

# Assume environment contains:
#   FOO="321"
#   BAR="1,2,3"

from config import config

print(config.FOO, type(config.FOO)) # 321 <class 'int'>
print(config.BAR, type(config.BAR)) # [1, 2, 3] <class 'list'>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for configoo, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size configoo-0.1.0-py3-none-any.whl (19.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size configoo-0.1.0.tar.gz (14.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page