Type-based validation for dict-based configs.
Project description
Apathetic Python Schema 🧩
📘 Roadmap · 📝 Release Notes
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.
[!NOTE] Heads up: the AI cooked dinner. It's edible, but watch your step.
Detailed bug reports welcome.
Quick Start
from apathetic_schema import apathetic_schema, ApatheticSchema_ValidationSummary
from apathetic_utils import schema_from_typeddict
from typing import TypedDict
from pathlib import Path
import json
# Define your config schema using TypedDict
class AppConfig(TypedDict):
name: str
version: str
port: int
debug: bool
# Load config from JSON
with Path("config.json").open() as f:
config = json.load(f)
# 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)
Installation
# Using poetry
poetry add apathetic-schema
# Using pip
pip install apathetic-schema
Documentation
For installation guides, API reference, examples, and more, visit our documentation website.
Features
- 🔍 TypedDict validation — Validate dict-based configs using Python TypedDicts
- 📋 Recursive validation — Supports nested TypedDicts and list types
- ⚠️ Error aggregation — Collect and report validation errors and warnings
- 🎯 Strict mode — Optional strict validation that treats warnings as errors
- 🔧 Type-aware — Works with mypy/pyright type annotations
- 🪶 Minimal dependencies — Only requires
apathetic-utils - 📝 Helpful errors — Provides context and suggestions for validation failures
⚖️ 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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apathetic_schema-0.1.0.tar.gz.
File metadata
- Download URL: apathetic_schema-0.1.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cb1b7a79e2aad9b663f0a52e6b5231849fc405df624ebb06923c0ef06e2c2e7
|
|
| MD5 |
d243bb4f6caee467dc9b7344f36b5715
|
|
| BLAKE2b-256 |
cf7fd897afc1860196ff5d3d03e111ea8715d06a6e427a77ec66b78e61c5e9da
|
Provenance
The following attestation bundles were made for apathetic_schema-0.1.0.tar.gz:
Publisher:
publish_pypi.yml on apathetic-tools/python-schema
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apathetic_schema-0.1.0.tar.gz -
Subject digest:
4cb1b7a79e2aad9b663f0a52e6b5231849fc405df624ebb06923c0ef06e2c2e7 - Sigstore transparency entry: 745745096
- Sigstore integration time:
-
Permalink:
apathetic-tools/python-schema@08de031b8bfa94584e5a78e8e55bfb57cd7e166c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/apathetic-tools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@08de031b8bfa94584e5a78e8e55bfb57cd7e166c -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file apathetic_schema-0.1.0-py3-none-any.whl.
File metadata
- Download URL: apathetic_schema-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31851413dc99f9623b4f3bd6058c818d96c283db0c9bcbd51b38477e7bf5abb6
|
|
| MD5 |
0fe1e0a07be167e1888590cdf5682e9b
|
|
| BLAKE2b-256 |
7bce02e23357f03731424e583806e0a1fe72969df46828a172b57752a4572a7d
|
Provenance
The following attestation bundles were made for apathetic_schema-0.1.0-py3-none-any.whl:
Publisher:
publish_pypi.yml on apathetic-tools/python-schema
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apathetic_schema-0.1.0-py3-none-any.whl -
Subject digest:
31851413dc99f9623b4f3bd6058c818d96c283db0c9bcbd51b38477e7bf5abb6 - Sigstore transparency entry: 745745152
- Sigstore integration time:
-
Permalink:
apathetic-tools/python-schema@08de031b8bfa94584e5a78e8e55bfb57cd7e166c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/apathetic-tools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@08de031b8bfa94584e5a78e8e55bfb57cd7e166c -
Trigger Event:
workflow_run
-
Statement type: