Optional class schemas
Use Schema for attribute access while keeping the released syntax limits visible.
Declare fields with Schema
Subclass Schema with concrete field annotations, then call validate(User, data) to get an instance with attributes. Dict schemas use the same validation engine.
from zodify import Schema, validate
class User(Schema):
name: str
age: int
user = validate(User, {"name": "Ada", "age": 36})
print(user.name)
print(user.age)
Ada
36Use the supported subset
Do not assume arbitrary postponed annotations, forward references, recursive models, general inheritance, generics, or every typing construct are supported. The example uses concrete annotations without 'from __future__ import annotations'.
Validator stores reusable validation options. Schema compilation and caching are unavailable in this release.
Version 0.8.1 fixes field discovery under Python 3.14 deferred annotations and evaluates supported annotation expressions at class definition. Fresh PyPI wheel checks passed on macOS CPython 3.14.6. The declared support range remains Python 3.10–3.13; this specific check does not establish broader Python 3.14 support. Unresolved names and unsupported string or postponed annotations still fail at class definition.