Skip to main content

didactic

PyPI Python License CI Docs

The didactic distribution provides immutable, validated Python models backed by Panproto. Each dx.Model compiles to a Panproto theory, so the same declaration can drive validation, schema migration, compatibility checks, code generation, and schema version control.

Install

Didactic requires Python 3.14 or later and panproto>=0.74.2.

pip install didactic

Define a model

import didactic.api as dx


class User(dx.Model):
    """A user record."""

    id: str
    email: str
    display_name: str = ""


user = User(id="u1", email="alice@example.com")
updated = user.with_(display_name="Alice")

assert updated.display_name == "Alice"
assert User.__theory__.name == "User"

Model construction checks Python types, field constraints, class axioms, and custom validators. Instances serialize to Python objects or JSON and update through with_(), which returns a new validated instance.

Describe indexed data

Use dx.Universe when one field selects the Python type accepted by another:

from typing import Annotated, Literal

import didactic.api as dx


Payload = dx.Universe("Payload", text=str, number=float)


class Record(dx.Model):
    kind: Literal["text", "number"]
    body: Annotated[str | float, Payload.at("kind")]


record = Record(kind="number", body=2.5)

The general dx.GADT API defines arbitrary indexed families, constructors, dependent motives, equations, rewrites, and user-defined eliminators. Panproto checks the declaration when compile() is called. Generated JSON Schema and OpenAPI preserve known cases as conditions, Pydantic adapters retain cross-field validation, and compatibility checks treat index changes as breaking.

Included APIs

The core distribution includes:

  • dx.Model, fields, validators, computed fields, and class axioms
  • references and embedded models for graph-shaped data
  • lenses, isomorphisms, and dependent lenses
  • migration registration, schema diffing, and migration synthesis
  • schema emitters and a filesystem-backed schema repository
  • property-based helpers for checking lens and migration laws
  • GADTs, indexed families, symbolic terms, reduction, and coverage checking

The didactic-pydantic, didactic-settings, and didactic-fastapi distributions add their modules under the didactic namespace.

Documentation

Read the tutorial and guides or the API reference.

License

Released under the MIT License.

Metadata

Release files for didactic 0.16.0

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

Source distribution (sdist)

Source distribution for didactic 0.16.0
File Size Uploaded
didactic-0.16.0.tar.gz 147.8 kB Details

Built distribution (wheel)

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

Total release size: 328.4 kB

Release files / didactic-0.16.0.tar.gz

Download URL didactic-0.16.0.tar.gz
Size 147.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d5a889d0d3782ce8286eac24f153cf38f5daa1e5daec74b3c73a0cae6eb5eaa0
BLAKE2b-256 checksum
How to use checksums
6b5faf9b342b10e5cb2ddcb2ebd01e395544a4e2f5c7835de4de6794f144e55a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / didactic-0.16.0-py3-none-any.whl

Download URL didactic-0.16.0-py3-none-any.whl
Size 180.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ce0d28bf420145d28a33504763af86203c0dde5b07a64eac64fbf10b3c7344a
BLAKE2b-256 checksum
How to use checksums
780d9238d853d634d91acd882d8df8198b6fbc928b193c86f334c27eb96cd685
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log
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