Minimal config framework
Project description
bean.config
bean.config is a minimal configuration framework for Python.
Define a configuration schema as a class, then populate it from one or more config sources with type validation and customizable source priorities.
Just enough to arrange some beans.
Overview
With bean.config you get:
- Typed configuration from a simple class definition.
- Multiple sources (
args,envs,overrides, custom sources). - Customizable priorities between configuration sources.
- Debugging helpers to inspect loaded configurations.
Installation
Requirements:
- Python
3.14+
Using pip:
pip install --upgrade bean-config
Using curl (direct download):
curl -Ls \
https://raw.githubusercontent.com/numen-0/bean/refs/heads/main/bean-config/src/bean/config.py
API
This is a quick reference for the main API.
For full details, see the source code.
Config Example
from enum import Enum
from bean import config
class Color(Enum):
RED = "#ff0000"
GREEN = "#00ff00"
BLUE = "#0000ff"
@config
class MySimpleConfig:
NAME: str
EMAIL: str
DEBUG: bool = False
PORT: int = 8080
HOST: str = "localhost"
COLORS: list[Color] = [Color.RED]
print(config.dump_str(MySimpleConfig))
Sources
Built-in sources
| source | description |
|---|---|
args |
command-line arguments parsed with argparse. |
envs |
environment variables. |
defaults |
default values defined on the configuration class. |
overrides |
values supplied via the overrides parameter. |
License
All the repo falls under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bean_config-0.1.0.tar.gz.
File metadata
- Download URL: bean_config-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d22b592f07ce0f32fc7a0e2aa85bdae5a9eb70a68bd76d1645d232a450efd33
|
|
| MD5 |
8bc35104ee5919e0f019202f55caf44b
|
|
| BLAKE2b-256 |
b223237eaaae07be1e7b9d6bc10f845669698370d92f11fa5a9bec56aed6cf5a
|
File details
Details for the file bean_config-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bean_config-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50604337c2c00d3a58833ce00cccc4778122228d3161cefbbdabee93b80c3e20
|
|
| MD5 |
204d3698dd4494269775bb28637ae890
|
|
| BLAKE2b-256 |
762bf9cd6518582d36413811666a7809aa61813ac36c04244165cf02e480a5c3
|