Skip to main content

Extensible library for separation of settings from code.

Project description


ClassyConf is an extensible library for settings & code separation.

It was born as a wrapper around prettyconf, inspired by goodconf.

It adds a declarative way to define settings for your projects contained in a class that can be extended, config objects can be passed around modules and settings are lazyly loaded, plus some other goodies.

It's classy, it's pretty, it's good.

Here is a preview of how to use it. You can find out more documentation at Read the Docs website.

from classyconf import Configuration, Value, EnvFile, IniFile

class AppConfig(Configuration):
    """Configuration for My App"""
    class Meta:
        loaders = [EnvFile(".env"), IniFile("/etc/conf.ini/")]

    DEBUG = Value(default=False, help="Toggle debugging.")
    DATABASE_URL = Value(
        help="Database connection.")

Later this object can be used to print settings

>>> conf = AppConfig()
>>> print(conf)

Or with __repl__()

>>> conf = AppConfig()
>>> conf
DEBUG=True (Toggle debugging.)
DATABASE_URL=postgres://localhost:5432/mydb (Database connection.)


class AppConfig(ClassyConf):
    class Meta:
        loaders = [IniFile("app_settings.ini")]

    DEBUG = Value(default=False)

class DevConfig(AppConfig):
    class Meta:
        loaders = [IniFile("test_settings.ini")]

accessed as dict or object


or passed around

def do_something(cfg):
    if cfg.DEBUG:   # this is evaluated lazily

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

classyconf-0.1.0.tar.gz (10.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page