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

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

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.6
File Size Uploaded
didactic-0.17.6.tar.gz 151.8 kB Details

Built distribution (wheel)

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

Total release size: 336.4 kB

Release files / didactic-0.17.6.tar.gz

Download URL didactic-0.17.6.tar.gz
Size 151.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e63ecf60b22330424b378a5a19a29b87e17e9156c8e7a4bd0b6cb4618d469b55
BLAKE2b-256 checksum
How to use checksums
65685d90aecfa2feb0d2dda7d675f0083ab5b948fed3543775f10a7bfe40be2e
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 12, 2026.

Transparency log

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

Download URL didactic-0.17.6-py3-none-any.whl
Size 184.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f251d197271dda9adab531e320248a0ff1222d48d23b7bd5e78430707e979f66
BLAKE2b-256 checksum
How to use checksums
2d4dbfc63a1cba3ae41ba821f0aaad9bcee096215f8a9dadf492dee64eaf93a0
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 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.18.0

2 release files

This release

0.17.6 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