Skip to main content

`konfetti` provides a framework-independent way for configuration of applications or libraries written in Python.

Project description

codecov Build Version Python versions License


konfetti is a Python configuration management system with an intuitive API, lazy evaluation and (a)sync Vault support.

The interface design and features are heavily inspired by decouple, Django, envparse and dynaconf.

Key features:

  • Lazy evaluation;
  • Built-in environment variables support;
  • Built-in async Vault access support;
  • Helpers for tests;
  • Django & Flask integration.

Benefits of lazy evaluation:

  • Faster & simpler test runs; No need for evaluation the the whole project config if it is not used
  • Avoid network calls during imports until necessary;


To use konfetti you need to define:

  • configuration variables in a module or a class;
  • an access point;

Settings module

# app_name/settings/
from konfetti import env, vault


DEBUG = env("DEBUG", default=False)
DATABASE_URI = vault("path/to/db")

The naming convention for variables names is upper case, other variables will be ignored. To work with Vault it is required to specify VAULT_ADDR and VAULT_TOKEN in the settings module.

Access point

# app_name/settings/
from konfetti import Konfig, AsyncVaultBackend

config = Konfig(vault_backend=AsyncVaultBackend("/secret/team"))

konfetti relies on KONFETTI_SETTINGS environment variable to discover your settings module, in the case above:

export KONFETTI_SETTINGS=app_name.settings.production

Alternatively the access point could be initiated from an object, importable string, mapping or a JSON file.

class TestSettings:
    VALUE = "secret"
config = Konfig.from_object(TestSettings, ...)
config = Konfig.from_object("", ...)

# If the config is in the same module
SECRET = vault("/path/to")["secret"]
config = Konfig.from_object(__name__, ...)
config = Konfig.from_mapping({"SECRET": 42}, ...)
config = Konfig.from_json("/path/to.json")


The settings module/class with configuration options shouldn’t be accessed directly, because the aforementioned features are implemented in the access point level.

from app_name.settings import config

async def something():
    await config.DATABASE_URI  # asynchronously taken from Vault
    debug = config.DEBUG  # Usual sync access


For full documentation, please see

Or you can look at the docs/ directory in the repository.

Python support

Konfetti supports Python 2.7, 3.5, 3.6, 3.7 and 3.8


The code in this project is licensed under MIT license. By contributing to konfetti, you agree that your contributions will be licensed under its MIT license.

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 konfetti, version 0.7.0
Filename, size File type Python version Upload date Hashes
Filename, size konfetti-0.7.0-py2.py3-none-any.whl (24.9 kB) File type Wheel Python version py2.py3 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