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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| seam_schema-0.1.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| seam_schema-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.34+ x86-64 | Details |
| seam_schema-0.1.0-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.0-cp39-abi3-win_amd64.whl
| Download URL | seam_schema-0.1.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 271.6 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e0988c0c637cc18d4b5a38162aea23c0fba93430b7e41e126b541cff2b7eea75
|
|
BLAKE2b-256 checksum How to use checksums |
c72fbdb674994b8e99fd1c959391666a2d48fc1e7438090a9fd5610e81562cc8
|
| 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 logRelease files / seam_schema-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl
| Download URL | seam_schema-0.1.0-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 |
f815da2f3a1ea84faadc61e7f39ff4fac06c222b84093705a1ecabac261509df
|
|
BLAKE2b-256 checksum How to use checksums |
815d282177b9c45959b358a1887fe9214ddcc88d27e010d8d51154ba05cd6ca4
|
| 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 logRelease files / seam_schema-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | seam_schema-0.1.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 378.9 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9f2c95c612d99f43e757eeb16eee9fa4c481e598a24b830cc9f87296715f244c
|
|
BLAKE2b-256 checksum How to use checksums |
5e0710841fe448dcb051c6d32ffb7d195feca026694c6d88c17544e3b4b8bbd1
|
| 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