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.17.1

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.17.1
File Size Uploaded
didactic-0.17.1.tar.gz 149.1 kB Details

Built distribution (wheel)

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

Total release size: 330.9 kB

Release files / didactic-0.17.1.tar.gz

Download URL didactic-0.17.1.tar.gz
Size 149.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d3092a31b7f1ac912b971d1aa4f9e7f03b4240a61f39aa8c33f27a740cd179bc
BLAKE2b-256 checksum
How to use checksums
65695679650453728a98bb6f20cfbe74ae3eb7307a22db767bf236357f7b1df5
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 16, 2026.

Transparency log

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

Download URL didactic-0.17.1-py3-none-any.whl
Size 181.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e37a0ce1a7c89e271e3f30aa250c8007d8e27f380eda76f7d169d27bfc4ef9f0
BLAKE2b-256 checksum
How to use checksums
adaa5a68a46c50bb5ada033e4643e750a12af702ff0df40095a1dd64f0c45478
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 16, 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