Skip to main content

A python package for reading configurations from different sources

Project description

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 ConfigError with an easy-to-read message (TTY-aware when printed in terminals).

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bubbleconf-0.2.2.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bubbleconf-0.2.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file bubbleconf-0.2.2.tar.gz.

File metadata

  • Download URL: bubbleconf-0.2.2.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for bubbleconf-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2190d64325e4ae4fae773c83ab8f6f1564132b0e54d17d9fdb63876f18c9558e
MD5 d524950ed84256dd144b6e13499a983e
BLAKE2b-256 d47a6f1ba84d63a41fdd46f0bd378564d2bfbd589e01acd0f9f677ec1b59d6ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for bubbleconf-0.2.2.tar.gz:

Publisher: publish.yml on bubbleconf/bubbleconf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bubbleconf-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: bubbleconf-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for bubbleconf-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d4dec693c7c6a9c4653c8ffa039f438a1a0ddd535e6baec8c8eac32d6f0663c5
MD5 70fa99ae5e722f9502251860cf36a524
BLAKE2b-256 b8fec0b3d282fa3ab0579ba0b82aefd513e36257657deb23770aad635a97c652

See more details on using hashes here.

Provenance

The following attestation bundles were made for bubbleconf-0.2.2-py3-none-any.whl:

Publisher: publish.yml on bubbleconf/bubbleconf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page