Dynaconf
Layered, 12-factor configuration management for Python with multi-format files, env vars, and secret backends.
Repository Health
Technical Analysis
Dynaconf is a configuration management library for Python inspired by the 12-factor app methodology. It provides a single settings object that transparently reads values from multiple sources — TOML, YAML, JSON, INI, and Python files, environment variables, .env files, and secret stores such as Hashicorp Vault and Redis — with a clear precedence order and support for layered environments like development, testing, and production.
Beyond loading, Dynaconf handles validation, type casting, templating, and protection of sensitive values, and ships first-class extensions for Django and Flask plus a CLI for initializing, listing, writing, validating, and exporting settings. It has zero required dependencies, keeping the core lightweight while optional extras enable format- and backend-specific features.
What You Get
- A unified
Dynaconfsettings object that reads TOML, YAML, JSON, INI, and Python config files - Full environment-variable override support with
.env(dotenv) loading - Layered multi-environment configuration (default, development, testing, production)
- Built-in loaders for Hashicorp Vault and Redis to store settings and secrets
- Django and Flask extensions plus a CLI for init, list, write, validate, and export
Common Use Cases
- Managing environment-specific settings for web apps across dev, staging, and production
- Loading and validating secrets from Vault or Redis instead of hardcoding credentials
- Overriding file-based defaults with environment variables in containerized deployments
Under The Hood
Architecture - The core is a LazySettings object (dynaconf/base.py) that defers configuration loading until first access, then delegates to an ordered chain of loaders in dynaconf/loaders/ (env, INI, JSON, py, Redis, TOML, YAML, Vault), each contributing values under a defined precedence. Environment layering, templating, and casting are applied through utils/parse_conf, while validator.py and validator_conditions.py enforce required keys and conditions. Framework glue lives in dynaconf/contrib/ (DjangoDynaconf, FlaskDynaconf) and the CLI in dynaconf/cli.py.
Tech Stack - Pure Python targeting 3.10–3.14 with zero required runtime dependencies; optional extras pull in ruamel.yaml, toml, configobj, redis, and hvac (Vault) only when their features are used, and some helpers are vendored under dynaconf/vendor/. Built with setuptools, linted/formatted with ruff, and documented via MkDocs (mkdocs.yml, dynaconf.com).
Code Quality - The project is mature and production-stable with an extensive tests/ suite (base, CLI, Django, Flask, format-specific loaders) plus a separate tests_functional/ tree and Codecov coverage tracking. Code is organized into focused modules with clear loader boundaries, and it has sustained contributions from 130+ contributors over a decade.
API Design - The public surface is intentionally small: instantiate Dynaconf(settings_files=[...], envvar_prefix=...) and access settings as attributes or dict keys. Sensible defaults (TOML by default, automatic env overrides) keep the getting-started path short, while the dynaconf init CLI scaffolds config files and the Validator API layers on stricter guarantees when needed.