bubbleconf
A tiny, battery-included configuration helper for Python projects. Use a dataclass to declare your configuration, then populate it from command-line arguments, environment variables, and sensible defaults with predictable priority.
Installation
pip install bubbleconf
Or, for development from this repository:
# from the repo root
python -m pip install --upgrade pip
python -m pip install --upgrade uv
uv sync
Short example
@dataclass
class MyConfig:
version: str
is_cool: bool = False
number_of_things: int = 0
ratio: float = 1.0
cfg = parse_config(MyConfig)
print(cfg)
You can set values by environment variables (VERSION, IS_COOL, ...), by CLI flags, or by defaults in the dataclass. The parser chooses values in a predictable priority order:
$ VERSION="0.1.2" uv run test.py --is_cool=true
MyConfig(version='0.1.2', is_cool=True, number_of_things=0, ratio=1.0)
CLI example
Advanced usage
- Boolean flags accept
0/1,true/false, and common truthy/falsy strings. - Unknown or invalid values raise a
ConfigErrorwith an easy-to-read message (TTY-aware when printed in terminals).
.env file support
bubbleconf can read configuration from a .env file in the working directory.
The path can be overridden with the DOTENV_FILE environment variable.
The dotenv source is included in the default priority order
(cli, env, dotenv, json, default), so process environment variables
still take precedence over file values. Supported syntax:
# comments and blank lines are ignored
NAME=Alice
export PORT=8080
GREETING="hello world"
TOKEN='shh # not a comment inside quotes'
DEBUG=true # trailing comments after unquoted values are stripped
To use only .env (and dataclass defaults), pass an explicit priority:
cfg = parse_config(MyConfig, priority=("dotenv", "default"))
Pretty-printing the resolved configuration
Pass pretty_log=True to log the fully resolved configuration as a
boxed table at INFO level on the bubbleconf logger:
import logging
logging.basicConfig(level=logging.INFO)
cfg = parse_config(MyConfig, pretty_log=True)
Output (colorized when stderr is a TTY; honours NO_COLOR and
BUBBLECONF_FORCE_COLOR):
Resolved configuration: MyConfig
┌────────┬───────────┬────────┐
│ Field │ Value │ Source │
├────────┼───────────┼────────┤
│ name │ "Alice" │ env │
│ port │ 9000 │ cli │
│ debug │ false │ default│
└────────┴───────────┴────────┘
Marking fields as secret
Use typing.Annotated with the Secret marker on any field that should
never appear in logs. Its value is replaced with "***" in both
pretty_log=True and report=True output, while the real value is
still set on the dataclass instance:
from dataclasses import dataclass
from typing import Annotated
from bubbleconf import Secret, parse_config
@dataclass
class ServiceConfig:
name: str
api_key: Annotated[str, Secret]
db_password: Annotated[str, Secret] = "dev"
cfg = parse_config(ServiceConfig, pretty_log=True)
# cfg.api_key contains the real value; the log shows "***"
Contributing
PRs are welcome. The project uses uv to manage the local environment. Run tests with:
uv run pytest -q
If you change packaging metadata, the CI workflow .github/workflows/publish.yml will build and either publish a dev build to TestPyPI or (for tagged commits) publish to PyPI.
License
This project is MIT-licensed. See the LICENSE file for details.
Metadata
Release files for bubbleconf 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bubbleconf-0.3.2.tar.gz | 20.2 kB | With provenance | Details for bubbleconf-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bubbleconf-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for bubbleconf-0.3.2-py3-none-any.whl |
Total release size: 37.9 kB
Release files / bubbleconf-0.3.2.tar.gz
| Download URL | bubbleconf-0.3.2.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb01816904e20549421b95bb1d2862bcb54ae803fd2bc9b3e01273f449d915d1
|
|
BLAKE2b-256 checksum How to use checksums |
53b28df7012ade7f479870e4e4c0ea8046c4218e6813bb551f998821486b75f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logRelease files / bubbleconf-0.3.2-py3-none-any.whl
| Download URL | bubbleconf-0.3.2-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19e036db2a1728b011a837aecc548637dc74bebf9da205a8357789ff7adf1137
|
|
BLAKE2b-256 checksum How to use checksums |
fc1c0d9a7e66581717974658a706f3b894074541562e582edd03ce11456326bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logSecurity for bubbleconf 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for bubbleconf-0.3.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.