Skip to main content

seam-schema

Python bindings for Seam: one schema, every language, no drift.

from seam_schema import Schema

schema = Schema.load("contracts/user.seam")
user = schema.validate("User", payload)

validate returns a plain dict, deliberately. A dict models Seam's four presence states natively, where an object with attributes cannot: absence is a missing key, null is a present key holding None.

"bio" in user            # was the key sent at all?
user["avatar"] is None   # was it sent as null?

Values come back normalised: a Date is a datetime.date, a DateTime is an aware datetime, and a u64 keeps every one of its bits.

Errors

from seam_schema import ValidationError

try:
    schema.validate("User", payload)
except ValidationError as e:
    e.path, e.code, e.message   # the first issue
    for issue in e.issues:      # all of them; validation does not stop at one
        print(issue.path, issue.code)

path and code are stable API. message is for humans.

Limits

Untrusted input is bounded in the engine, so the defaults apply whether or not you ask. Tighten them to what a legitimate request actually looks like:

from seam_schema import Limits

schema.validate("User", payload, Limits(max_items=100, max_string_bytes=4096))

Static types

A schema loaded at runtime is opaque to a type checker, by construction. So the .seam file feeds two paths: validation at runtime, and types through seam typegen.

seam typegen contracts/user.seam        # writes contracts/user_types.py
from contracts.user_types import validate_user

user = validate_user(payload)
user["name"]        # mypy knows this is str
user["nmae"]        # mypy rejects it

The four presence states land on Python's own vocabulary for them, which is why TypedDict was the right target:

.seam generated
String name: str
String? nickname: str | None
optional String bio: NotRequired[str]
optional String? avatar: NotRequired[str | None]

The generated file holds no rules. Delete it and everything still runs; you only lose static checking. That is the test that it is not a second source of truth.

Keep it honest in CI:

seam typegen --check contracts/*.seam   # fails if stale or missing

Status

Early development, not yet on PyPI. Build from a checkout:

pip install ./seam-py
pytest seam-py/tests

Metadata

Release files for seam-schema 0.1.1

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

Built distributions (wheels)

Table of built distributions (wheels) for seam-schema 0.1.1
File Interpreter ABI Platform
seam_schema-0.1.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
seam_schema-0.1.1-cp39-abi3-manylinux_2_34_x86_64.whl CPython 3.9 abi3 Linux glibc 2.34+ x86-64 Details
seam_schema-0.1.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 1.1 MB

Release files / seam_schema-0.1.1-cp39-abi3-win_amd64.whl

Download URL seam_schema-0.1.1-cp39-abi3-win_amd64.whl
Size 271.6 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6d0c9f8f68de117d64e966c8b90ec0b5e85a5fc436c39bca70f54cb9b502409a
BLAKE2b-256 checksum
How to use checksums
80d442886d4fc3bea9ed8c8f140104e72eaa171d8069da80fcc03132000dc0f2
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 1, 2026.

Transparency log

Release files / seam_schema-0.1.1-cp39-abi3-manylinux_2_34_x86_64.whl

Download URL seam_schema-0.1.1-cp39-abi3-manylinux_2_34_x86_64.whl
Size 418.9 kB
Tags CPython 3.9 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
b09a77ecbc6b73c9bb4b2fec047cc9669fc7511acd448c3e4d49c53233c84e2f
BLAKE2b-256 checksum
How to use checksums
fdf87d90a5f1ef351b45afe5840df937b4898ba7c2f727582efed4b24c5f5ae5
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 1, 2026.

Transparency log

Release files / seam_schema-0.1.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL seam_schema-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
Size 379.0 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8ba883855f9b5e112cf7990d7ad97c4e8e87741aeeb907ed962eac7e328a6e54
BLAKE2b-256 checksum
How to use checksums
aafb875a1ba10f17293baff2d71234ec569463f20cd7a5e04205487e7362a8b0
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 1, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

3 release files

0.1.2

3 release files

This release

0.1.1 This release

3 release files

0.1.0

3 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