Skip to main content

Helpers for dealing with application settings

Project description

COOLFIG

https://img.shields.io/travis/GaretJax/coolfig.svg https://img.shields.io/pypi/v/coolfig.svg https://img.shields.io/pypi/dm/coolfig.svg https://img.shields.io/coveralls/GaretJax/coolfig/master.svg https://img.shields.io/badge/docs-latest-brightgreen.svg https://img.shields.io/pypi/l/coolfig.svg https://img.shields.io/requires/github/GaretJax/coolfig.svg

Coolfig is a library to easily write configuration specifications to be fulfilled by various sources.

Installation

pip install coolfig

Example

Define your schema:

from coolfig import Settings, Value, types

class DefaultSettings(Settings):
     SECRET_KEY = Value(str)
     DEBUG = Value(types.boolean, default=False)
     DB_URL = Value(types.sqlalchemy_url)
     LOCALES = Value(types.list(str))

Instantiate the configuration with a data provider:

import os
from coolfig import providers

settings = DefaultSettings(
    providers.DictConfig(os.environ, prefix='MYAPP_'))

Profit:

if settings.DEBUG:
    print(settings.SECRET_KEY)
else:
    print(settings.LOCALES)

connect(settings.DB_URL)

History

0.2.0 - 2015-05-31

  • Added a EnvConfig provider

  • Added a dottedpath value type

0.1.0 – 2015-05-30

  • Initial release

Project details


Download files

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

Source Distribution

coolfig-0.2.0.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distribution

coolfig-0.2.0-py2-none-any.whl (7.4 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page