Configuration Management for Python projects, modules, applications, and microservices.
Compose structured hierarchical configurations from multiple sources. Enable your code to adapt seemlessly to the current context. Allow users in different contexts to use the config source that works best for them.
- Hierarchical priority: CLI > Environment > config file > module defaults
- Provides builtin support for common config sources:
- CLI args
- Environment Variables
- Config File (yaml)
- Config classes with default values
- Easily extendable, add new sources to serve your needs.
- Set reasonable defaults, and override them as needed.
- Designed for 12-factor applications (config via Environment Variables)
Users can create their own config sources
by creating classes that satisfy batconf.source.SourceInterfaceProto
(or subclass batconf.source.SourceInterface)
The config lookup order is determined by the SourceList instance,
which can be adjusted to suit your needs.
- Non-Intrusive Integration: BatConf can be seamlessly incorporated
into existing projects with minimal code modifications.
- imports from batconf can be isolated to a single source file
- Config classes utilize stdlib dataclasses
- Portability and Modularity: Modules (sub-modules or entire projects) that
use batconf configuration
should be easy to compose and refactor.
- modules can be easily plugged in to other modules.
- modules can be easily factored out (into new projects).
Professionally supported BatConf is now available.
Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.
Get supported BatConf with the Tidelift subscription
Check out our Quick Start Guide
and the example project in tests/example/ which includes tests and documentation.
Install the core package:
pip install .
Install with Yaml support:
pip install .[yaml]
Install with Toml support, for python<=3.11:
pip install .[toml]
[project]
dependencies = [
'batconf',
]Including optional extras, like Yaml:
[project]
dependencies = [
'batconf[yaml]',
]pip install --group=dev -e .
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
