Install zodify

Use a virtual environment with supported Python 3.10–3.13. Pin 0.8.1 to run the same release as these examples.

python -m pip install zodify==0.8.1

Validate a dict and read the result

Pass the schema first and the data second. Valid input returns a dict; invalid input raises ValueError. This example prints both the successful result and the error for a string where an int is expected.

Python
from zodify import validate

schema = {"name": str, "age": int}
print(validate(schema, {"name": "Ada", "age": 36}))

try:
    validate(schema, {"name": "Ada", "age": "36"})
except ValueError as error:
    print(f"ValueError: {error}")
Output
{'name': 'Ada', 'age': 36}
ValueError: age: expected int, got str

Updated 2026-10-18 / Edit this page