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

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.3
File Interpreter ABI Platform
seam_schema-0.1.3-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
seam_schema-0.1.3-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.3-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.3-cp39-abi3-win_amd64.whl

Download URL seam_schema-0.1.3-cp39-abi3-win_amd64.whl
Size 271.7 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
cf2d161e36effff5602f2c07ee76fd3ab95d2626fb246d96a56a4ff920978b97
BLAKE2b-256 checksum
How to use checksums
656e5dd2ef6f5f611f26cab63f2b8269829652cf88d85bb82ac46c9a8070eca9
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.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL seam_schema-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 380.1 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d6cad42dab31384b8317fd0a29045cf2139e25f8de6e05d8a4b22c59c61a2be4
BLAKE2b-256 checksum
How to use checksums
883228e1ce51e727276fbaef1e7363d2f57ec3c01d4a96036493173302d809aa
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.3-cp39-abi3-macosx_11_0_arm64.whl

Download URL seam_schema-0.1.3-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
f4495926deb5d8be791edbba60be65b5d816b320fd58f806c1e6ee94f418694a
BLAKE2b-256 checksum
How to use checksums
3db2ff64eaacb401723849c9c99d4d97fe07478bece7ec717ac6700c24e27297
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

This release

0.1.3 This release

3 release files

0.1.2

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