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

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

Built distribution (wheel)

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

Total release size: 330.9 kB

Release files / didactic-0.17.2.tar.gz

Download URL didactic-0.17.2.tar.gz
Size 149.1 kB
Tags Source
SHA-256 checksum
How to use checksums
186930220dad43af1da2ddefcc051dc6b3b11eb4829558c67219bf2987c5136d
BLAKE2b-256 checksum
How to use checksums
396b5bc57a0cb01eeaa37ac6c8b1717f5216a996a23dabc6ac0de4b45dba344a
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 Oct 8, 2026.

Transparency log

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

Download URL didactic-0.17.2-py3-none-any.whl
Size 181.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8703661182a6a564b4ed56ec8ed3aa985e9b028c6783b8935a01a8c9189dba40
BLAKE2b-256 checksum
How to use checksums
61dcc6e790c025ce4621470bb56a8576df69fc0947063e8c514ee29e6eb2c0f3
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 Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.18.0

2 release files

0.17.6

2 release files

This release

0.17.2 This release

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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