Skip to main content

Unified configuration management for the dd-* ecosystem

Project description

dd-config

Unified configuration management for the dd-* ecosystem — load, merge, validate and convert config files across multiple formats with a single clean API.

Install

pip install dd-config                    # JSON + INI + .env support (stdlib only)
pip install "dd-config[yaml]"            # + YAML support
pip install "dd-config[all]"             # all formats including TOML

Quick start

from dd_config import Config

# Load a YAML config
cfg = Config.load("splflow.yaml")

# Plain key access
adapter = cfg["llm_adapter"]            # "ollama"

# Dot-path access for nested keys
host = cfg["database.host"]

# Safe get with default
port = cfg.get("database.port", 5432)

# Layer overrides on top (later files win)
cfg = Config.load("base.yaml", overrides=["local.yaml", ".env"])

Supported formats

Format Extension Extra required
JSON .json none (stdlib)
YAML .yaml, .yml pip install "dd-config[yaml]"
TOML .toml pip install "dd-config[all]"
INI .ini, .cfg none (stdlib)
Env .env none (stdlib)

Features

  • Multi-format — one API for JSON, YAML, TOML, INI, .env
  • Auto-detection — format inferred from file extension
  • Layered loading — base config + multiple override files; last writer wins
  • Dot-path accesscfg["server.port"] instead of cfg["server"]["port"]
  • Env interpolation${VAR:-default} tokens expanded on load
  • Format conversionConfig.convert("app.yaml", "app.json")
  • Validation — required-key and type checks raise ValidationError
  • Plain dictcfg.to_dict() returns a plain Python dict; no magic objects
  • Lazy deps — YAML/TOML libraries only imported when actually used

Validation

cfg.validate(required=["llm_adapter", "database.host"])
cfg.validate(schema={"database.port": int, "debug": bool})

Saving & converting

cfg["llm_adapter"] = "openrouter"
cfg.save("splflow.yaml")               # write back to YAML
Config.convert("splflow.yaml", "splflow.json")   # one-liner format conversion

Environment variable interpolation

Values like ${OPENROUTER_API_KEY:-} in config files are expanded from the environment at load time. Useful for secrets that must not be committed to VCS:

openrouter:
  api_key: ${OPENROUTER_API_KEY}
  base_url: https://openrouter.ai/api/v1

Merge

base = Config.load("base.yaml")
local = Config.load("local.yaml")
merged = base.merge(local)             # local wins on conflict; non-destructive

License

MIT © 2026 digital-duck

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

dd_config-0.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

dd_config-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file dd_config-0.1.0.tar.gz.

File metadata

  • Download URL: dd_config-0.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for dd_config-0.1.0.tar.gz
Algorithm Hash digest
SHA256 534e716ec776b5a3f8c6d0012effb0f1b8370a827e934cd57980d521098e4525
MD5 97f3372bde6d0d8759ba333e92e9736c
BLAKE2b-256 6a92a46e6e841b35d5e87ad9cc7b36e76c4fd9489c5a6439ade58db85c24ee72

See more details on using hashes here.

File details

Details for the file dd_config-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dd_config-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for dd_config-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db5f710f85885ccf6c0e0e6a07950e444797b2bda71c29d6c744fe908846c450
MD5 070c68a4e69d7f50b47a56a4a806ddb4
BLAKE2b-256 3776f32226e23517f263697eb60d280951c82b7bc827019c3330956d819fe609

See more details on using hashes here.

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