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

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.3
File Size Uploaded
didactic-0.17.3.tar.gz 150.5 kB Details

Built distribution (wheel)

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

Total release size: 333.9 kB

Release files / didactic-0.17.3.tar.gz

Download URL didactic-0.17.3.tar.gz
Size 150.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9788204b58721c162d66f92f701070dd227d5964fe7e9bba0596987100b2e10f
BLAKE2b-256 checksum
How to use checksums
782ff9f93cbbdc158ba839b2baf7b2d422ce671752e49eb55d3bc2f457ec69e4
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 9, 2026.

Transparency log

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

Download URL didactic-0.17.3-py3-none-any.whl
Size 183.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e46b3d9d70864d0ffac29d8c5cb7c3e4fe5af1d63dd1c5f232f06d4adbddab9
BLAKE2b-256 checksum
How to use checksums
12bb0516db9ea621ac25f04e8fa7c69b8b10a02ba3e08a4ad9080a9574089c91
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 9, 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.3 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