Skip to main content

kaava

Typed configuration made traceable: Checking, diagnosing, explaining, loading, scaffolding, and validating dataclass configuration through an API and a CLI.

Requires Python 3.11 or later.

YAML support uses ruamel.yaml (default) or PyYAML, each parsing in C when its C parser is installed; TOML and JSON use the standard library.

Install

pip install kaava                 # ruamel.yaml and python-jsonpath
pip install 'kaava[fast-yaml]'    # and ruamel.yaml.clib, the C parser of ruamel.yaml
pip install 'kaava[pyyaml]'       # and PyYAML, the alternate YAML backend
pip install 'kaava[all]'          # both extras

The extra fast-yaml (alias ruamel-yaml-clib) installs the C parser on CPython up to 3.14, where it has wheels; elsewhere it installs nothing and kaava parses in pure Python. kaava parses with a C parser whenever one is installed, several times faster for large files; a text the C parser refuses (ruamel.yaml.clib does not take a: [http://e.org], which YAML 1.2 allows) is parsed again in pure Python, so the data are the same. KAAVA_YAML_FAST=0 (or --no-fast-yaml on the command line) switches it off, KAAVA_YAML_FAST=1 requires it; KAAVA_YAML_BACKEND=pyyaml selects PyYAML, which parses with the libyaml its wheels usually bundle. kaava info env shows what parses, and which extras are installed. kaava complete needs shtab (pip install shtab), which no extra brings.

Quickstart

Define your configuration shape as a plain dataclass and call load().

import dataclasses
from kaava import conf_field, load


@dataclasses.dataclass
class DBConfig:
    host: str = conf_field(description='database host')
    port: int = conf_field(default=5432)


@dataclasses.dataclass
class AppConfig:
    name: str = conf_field(description='application name')
    db: DBConfig = conf_field(description='database connection')
    debug: bool = conf_field(default=False)


cfg = load(AppConfig, 'config.yaml')
print(cfg.name, cfg.db.host, cfg.db.port)

config.yaml:

name: myapp
db:
  host: localhost

Fields with no default or default_factory are required. Nested dataclasses map to YAML mappings and are built recursively. load() raises on the first error encountered; use validate() or load_valid() to collect all errors.

For a quick feature-by-feature tour, see quickstart. For a step-by-step tutorial that builds a real command-line tool from scratch, see tutorial.

Learn more

kaava's man pages are installable locally with kaava eject man (see man kaava) or browsable under docs/man/:

  • man kaava -- the CLI: doctor, explain, validate, eject config, eject man, complete, version; options, exit codes, examples.
  • man 3 kaava -- the full library API: every exported function and type (load, doctor, explain, conf_field, the overlay builders, the error hierarchy), exact signatures and behavior.
  • man 5 kaava -- file formats: the CLI's own settings (~/.config/kaava/cli.yaml), the auto-discovery locations load() falls back to, and the dotenv format.
  • man 7 kaava -- the sources-then-overlays loading model end to end, a worked "adopting kaava in a new project" walkthrough, and how the CLI configures itself using the same load() any caller uses.

Companion CLI

The kaava command exposes the library's diagnostic functions as subcommands, against a dotted import path (module.path:ClassName):

kaava doctor          myapp.config:AppConfig config.yaml
kaava explain         myapp.config:AppConfig config.yaml
kaava validate        myapp.config:AppConfig config.yaml
kaava eject config    myapp.config:AppConfig

A remembered default target (see man 5 kaava) lets every command above drop the dataclass path and sources entirely: kaava doctor alone. Every command, subcommand, and long option accepts an unambiguous prefix (kaava ver for kaava version); calling kaava or kaava eject alone prints that command's own help and exits 0.

Design and requirements

Software Requirements Specification : KAA-SRS-001 -- requirements/

Software Design Description : KAA-SDD-001 -- design/

Both documents follow the MIL-STD-498 DID structure and are rendered into the documentation site alongside the tutorial and quickstart.

Changes

See releases/ for the release history, or releases/changes/ for the full detail behind each summary.

Complexity

The code base complexity is documented at complexity/.

Coverage

The test suite maintains 100% branch coverage. The HTML report (if generated) is in site/coverage/.

Performance

Each release is measured on its workloads -- cold start (import kaava and the CLI), the example configuration, and scaling with the number of fields -- and checked against performance promises; the results and findings are at perf/.

SBOM

Runtime dependency information is published in docs/sbom/ in SPDX 3.0 (JSON-LD) and CycloneDX 1.6 (JSON) formats. See docs/sbom/README.md for the component inventory and validation guide.

Metadata

Release files for kaava 2026.11.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kaava 2026.11.29
File Size Uploaded Provenance Actions
kaava-2026.11.29.tar.gz 148.5 kB Without provenance Details for kaava-2026.11.29.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kaava 2026.11.29
File Interpreter ABI Platform Actions
kaava-2026.11.29-py3-none-any.whl Python 3 none any Details for kaava-2026.11.29-py3-none-any.whl

Total release size: 225.0 kB

Release files / kaava-2026.11.29.tar.gz

Download URL kaava-2026.11.29.tar.gz
Size 148.5 kB
Tags Source
SHA-256 checksum
How to use checksums
367280ff59a253ab66a965e8962e67114947b99daa4f571628b73677977672f8
BLAKE2b-256 checksum
How to use checksums
5e2da93e5fea7cd459de1f6718072809bf2c62ba8b8cc28e84c69ff3372855f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / kaava-2026.11.29-py3-none-any.whl

Download URL kaava-2026.11.29-py3-none-any.whl
Size 76.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22cb870c947a34482f82772b25d43d44a4d57e82c4313f44a32c151ee7f1115d
BLAKE2b-256 checksum
How to use checksums
41a7aca4fd8c6388b33b830919b922cba5828a8fbddbf2a5e20c135e874e7826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for kaava 2026.11.29

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page