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

pip install seam-schema

Early development, published at 0.1.2. One abi3 wheel per platform covers Python 3.9 and up. Wheels ship for Linux x64 (glibc 2.17 and up, manylinux2014, so not Alpine), macOS ARM and Windows x64; on any other platform the install fails rather than falling back, because there is nothing to fall back to.

Build from a checkout:

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

Metadata

Release files for seam-schema 0.1.2

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.2
File Interpreter ABI Platform
seam_schema-0.1.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
seam_schema-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
seam_schema-0.1.2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 1.0 MB

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

Download URL seam_schema-0.1.2-cp39-abi3-win_amd64.whl
Size 271.8 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1141f8c45744aa8e684fa90f4b4874c2140fe4f777329d43189d2b8d7dc9ac33
BLAKE2b-256 checksum
How to use checksums
4a332b8d4f1bd2e1f5ab26b0f3c323e7918a1ee2251d2b09ae56f231c063dd44
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 3, 2026.

Transparency log

Release files / seam_schema-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL seam_schema-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 380.0 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
961b3054d9aed199af38174d383d86ff3df04809f1dfc888502aef2cf6a5554d
BLAKE2b-256 checksum
How to use checksums
a821baf760deb09a7a7877bf2edba0f0dbeddc5f69e80b567d6ef686270c8f5a
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 3, 2026.

Transparency log

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

Download URL seam_schema-0.1.2-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
aff970969b384216782c24f4832737637bd26d691b75978fe915d4ab99d79e5a
BLAKE2b-256 checksum
How to use checksums
0966aac4e63c0eff165dbb6c40003a57c4d8c1e737a64a02383064468c368d17
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 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

3 release files

This release

0.1.2 This release

3 release files

0.1.1

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