Skip to content

Tatch-AI/brek-python

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors