Apathetic Python Schema 🧩

Lightweight validation for dict-based configs.
Types can be schema too.

Apathetic Python Schema validates dict-based data structures (configs, usually from JSONC/JSON/TOML) using Python TypedDicts used for mypy/pyright. No need for separate schema definitions β€” your type annotations are your schema.

Features

Quick Example

from apathetic_schema import apathetic_schema, ApatheticSchema_ValidationSummary
from apathetic_utils import schema_from_typeddict, load_jsonc
from typing import TypedDict
from pathlib import Path

# Define your config schema using TypedDict
class AppConfig(TypedDict):
    name: str
    version: str
    port: int
    debug: bool

# Load config from JSONC
config = load_jsonc(Path("config.jsonc"))

# Validate against TypedDict schema
summary = ApatheticSchema_ValidationSummary(valid=True, errors=[], strict_warnings=[], warnings=[], strict=False)
schema = schema_from_typeddict(AppConfig)

is_valid = apathetic_schema.check_schema_conformance(
    config,
    schema,
    "in configuration file",
    strict_config=False,
    summary=summary,
)

if not summary.valid:
    print("Validation errors:", summary.errors)
    print("Warnings:", summary.warnings)

Requirements

Installation

Install via poetry or pip:

# Using poetry
poetry add apathetic-schema

# Using pip
pip install apathetic-schema

For alternative installation methods, see the Installation Guide.

Documentation

License

MIT-a-NOAI License

You’re free to use, copy, and modify the library under the standard MIT terms.
The additional rider simply requests that this project not be used to train or fine-tune AI/ML systems until the author deems fair compensation frameworks exist.
Normal use, packaging, and redistribution for human developers are unaffected.

Resources