donfig
Python package for configuring a python package
What it is and what it does
Donfig is a configuration library that abstracts away the boilerplate of managing application settings across multiple sources. It originated from the dask library's configuration system and provides a Config object that can be instantiated per package to centralize settings management. The library automatically loads configuration from environment variables (prefixed with the config object's name in uppercase), YAML files in standard system locations (~/.config, /etc, sys.prefix/etc), and programmatic calls. This multi-source approach lets developers and users configure applications without modifying code, using whichever method fits their workflow.
The package is lightweight, depending only on pyyaml, and supports context managers for temporary configuration changes. It's designed to be embedded in other packages rather than used standalone, making it useful for library authors who want to offer their users flexible configuration without building a custom system.
Use it for:
- Embed configuration management in a data science or scientific Python package without building custom config logic.
- Allow users to override package settings via environment variables in containerized or cloud deployments.
- Load application defaults from YAML files in standard system locations, with user overrides in home directories.
- Provide temporary configuration changes within a code block using context managers without global state pollution.
- Centralize package-wide settings in a single Config object accessible throughout a codebase.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Donfig provides a unified configuration system for Python packages, supporting programmatic setup, environment variables, and YAML files from standard locations.
Yes. Donfig is a lightweight, actively maintained library with no known vulnerabilities, a permissive MIT license, and low install friction. It solves a real problem—multi-source configuration management—that library authors would otherwise implement themselves. Suitable for any Python package that needs flexible user-facing configuration.
Install
donfig on PyPI
pip
pip install donfiguv
uv add donfigpoetry
poetry add donfigInstalling donfig
Before you install
Low install friction with a single pure-Python dependency (pyyaml). Actively maintained with recent commits; last release was in 2024-05-23 and the repository remains active.
License in practice
MIT license (permissive) allows use in commercial and proprietary projects with minimal restrictions; original dask code also acknowledged under its prior license.
Quickstart
pip install donfig
from donfig import Config
config = Config('mypkg')
config.set(important_key=5)
value = config.get('important_key')
Requires Python 3.8 or later.
Verify before relying
- Whether the package handles complex nested YAML structures or has limitations on config depth.
- Performance characteristics when loading large configuration files or managing many config keys.
- Thread-safety guarantees for concurrent access to the Config object.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyyaml |
| Maintenance | actively maintained — 813 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,985,314/month — #1,996 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: donfig-0.8.1.post1-py3-none-any.whl
Keywords: task-scheduling, parallel, numpy, pandas, pydata
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
bestconfigLoads configuration from multiple file formats…
permissive · top 15,000 on PyPI
apipkgapipkg lets you define a package's exported…
permissive · top 5,000 on PyPI
yaml-configReads configuration from YAML files and…
unclear · top 5,000 on PyPI
lib-layered-configLoads and merges configuration from multiple…
permissive · top 15,000 on PyPI
rapids-dask-dependencyPins compatible versions of dask and…
permissive · top 15,000 on PyPI
configuratorBuilds a configuration store by layering…
permissive · top 15,000 on PyPI
hierarchical-confLoads configuration from YAML files organized…
unclear · top 15,000 on PyPI
confuseConfuse is a YAML configuration library that…
permissive · top 5,000 on PyPI
ConfigArgParseExtends Python's argparse to parse command-line…
permissive · top 1,000 on PyPI
pyaml-envParses YAML configuration files and resolves…
permissive · top 15,000 on PyPI