← ClaudeAtlas

coding-python-layered-configlisted

Use when building or designing configuration for a Python app or CLI with lib_layered_config - deciding where config files live on Linux, macOS, or Windows, choosing the environment-variable override names, adding environment profiles (test/staging/production), loading config in code or from the shell, redacting secrets, or working out which layer and file a setting actually came from (provenance).
bitranox/bitranox-skills · ★ 1 · AI & Automation · score 57
Install: claude install-skill bitranox/bitranox-skills
# lib_layered_config Load one immutable configuration object by deep-merging six layers, and be able to say where every value came from. `lib_layered_config` is a cross-platform config loader for Python 3.10+ with a matching CLI. It is designed to be driven by an LLM/agent as well as a human - this skill is that agent guide. ## The core model Six layers are merged in a fixed precedence, **lowest to highest**: ``` defaults -> app -> host -> user -> dotenv -> env ``` Later layers override earlier ones key-by-key (unrelated keys are kept, not dropped). The result is a frozen `Config`. Every value records the layer and file that produced it. Do not forget `defaults` (the lowest layer, seeded from an explicit `default_file`) or that `env` (process environment variables) wins over everything. ## Install ```bash pip install lib_layered_config # TOML + JSON (via rtoml / orjson) pip install "lib_layered_config[yaml]" # add optional YAML support ``` Requires Python 3.10+. Install the `yaml` extra only if you ship `.yml` files. ## Load config (Python) ```python from lib_layered_config import read_config config = read_config( vendor="Acme Corp", app="My App", slug="my-app", default_file="defaults.toml", # seeds the `defaults` layer (the lowest one) ) config.get("service.timeout", default=30) # dotted-path access config["database"]["host"] # mapping access config.origin("service.timeout") # -> which layer + file set it (provenance) ``` - `vendor`