Skip to main content

Python port of brek, a structured config loader with layered files and loaders.

Project description

brek

build status SemVer Conventional Commits AutoRel

This project is the Python port of the original brek project.

brek keeps the same core principles:

  • declarative JSON configuration
  • layered config files
  • strict environment variable interpolation via ${VAR}
  • loader-based dynamic values
  • a bundled AWS Secrets Manager loader
  • strict runtime resolution for required config paths

brek stands for Blocking Resolution of Environment Keys.

Quick Start

Install from PyPI:

python -m pip install brek

Or install from a checkout:

python -m pip install -e .

Create a config/default.json file:

{
  "port": 3000,
  "postgres": {
    "host": "localhost"
  },
  "secret": {
    "[awsSecret]": {
      "key": "demo",
      "region": "us-west-2"
    }
  }
}

Generate the resolved cache:

brek load-config

brek load-config always re-resolves config and rewrites the generated cache file. Within a running Python process, GetConfig() is cached after the first load.

Or use it from Python:

from brek import DefaultLoaders, GetConfig, SetLoaders, require_path

SetLoaders(DefaultLoaders())
conf = GetConfig()
print(require_path(conf, "port"))

Features

  • JSON config files with default, environment, deployment, and user overlays.
  • CLI and environment overrides through BREK or OVERRIDE.
  • Environment variable expansion via ${VAR} syntax.
  • Loader support for runtime values.
  • Bundled awsSecret loader for AWS Secrets Manager.
  • Strict access helpers for required and optional paths.
  • Standard-library core with no mandatory runtime dependencies.

Docs

Development

make test

Release

Releases are created by AutoRel from conventional commits on main and next. When GitHub creates a release, the pypi-publish.yml workflow builds an sdist and wheel and publishes them to PyPI using Trusted Publishing.

To enable publishing, configure Tatch-AI/brek-python as a trusted publisher in the PyPI project settings for the pypi environment and .github/workflows/pypi-publish.yml.

Support

The original implementation lives at mhweiner/brek.

Releases are automated with autorel from conventional commits on main and next.

Release commits should follow the same conventional-commit format used by the original project.

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

brek-0.1.4.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

brek-0.1.4-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file brek-0.1.4.tar.gz.

File metadata

  • Download URL: brek-0.1.4.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brek-0.1.4.tar.gz
Algorithm Hash digest
SHA256 07916f4cc0d9b0b901a8639d10ee218a2e9cc8e393fc5f44721b8e4d9cab06f4
MD5 6e781e0e3e9784c1ceaf58a97c5f57e0
BLAKE2b-256 4777fc3b3f63c96a9c11293f6538a8af442cb9685ff2721cd17b3840f0b14da0

See more details on using hashes here.

Provenance

The following attestation bundles were made for brek-0.1.4.tar.gz:

Publisher: pypi-publish.yml on Tatch-AI/brek-python

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

File details

Details for the file brek-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: brek-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brek-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 35cb9d2ca8f87f175cbceeaaa6e61d6b61c631d2c588305fd425ca72c10bb8f7
MD5 45ceda8d4914d79be57d4eb604106b7a
BLAKE2b-256 5bb8f21cf65ff048c88824818c1ab567f8a24b20f93bb9938a5026bced3f53f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for brek-0.1.4-py3-none-any.whl:

Publisher: pypi-publish.yml on Tatch-AI/brek-python

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