coding-python-layered-configlisted
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`