Typesystem
Data validation, serialization, deserialization & form rendering. 🔢
Install / Use
/learn @encode/TypesystemREADME
TypeSystem
<p> <a href="https://github.com/encode/typesystem/actions"> <img src="https://github.com/encode/typesystem/workflows/Test%20Suite/badge.svg" alt="Build Status"> </a> <a href="https://codecov.io/gh/encode/typesystem"> <img src="https://codecov.io/gh/encode/typesystem/branch/master/graph/badge.svg" alt="Coverage"> </a> <a href="https://pypi.org/project/typesystem/"> <img src="https://badge.fury.io/py/typesystem.svg" alt="Package version"> </a> </p>Documentation: https://www.encode.io/typesystem/
TypeSystem is a comprehensive data validation library that gives you:
- Data validation.
- Object serialization & deserialization.
- Form rendering.
- Marshaling validators to/from JSON schema.
- Tokenizing JSON or YAML to provide positional error messages.
- 100% type annotated codebase.
- 100% test coverage.
- Zero hard dependencies.
Requirements
Python 3.6+
Installation
$ pip3 install typesystem
If you'd like you use the form rendering using jinja2:
$ pip3 install typesystem[jinja2]
If you'd like you use the YAML tokenization using pyyaml:
$ pip3 install typesystem[pyyaml]
Quickstart
import typesystem
artist_schema = typesystem.Schema(
fields={
"name": typesystem.String(max_length=100)
}
)
definitions = typesystem.Definitions()
definitions["Artist"] = artist_schema
album_schema = typesystem.Schema(
fields={
"title": typesystem.String(max_length=100),
"release_date": typesystem.Date(),
"artist": typesystem.Reference("Artist", definitions=definitions)
}
)
album = album_schema.validate({
"title": "Double Negative",
"release_date": "2018-09-14",
"artist": {"name": "Low"}
})
print(album)
# {'title': 'Double Negative', 'release_date': '2018-09-14', 'artist': {'name': 'Low'}}
Alternatives
There are plenty of other great validation libraries for Python out there, including Marshmallow, Schematics, Voluptuous, Pydantic and many others.
TypeSystem exists because I want a data validation library that offers first-class support for:
- Rendering validation classes into HTML forms.
- Marshaling to/from JSON Schema.
- Obtaining positional errors within JSON or YAML documents.
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
104.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
345.4kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
