schema
Simple data validation library
Install
schema on PyPI
pip
pip install schemauv
uv add schemapoetry
poetry add schemaPackage facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — contextlib2 |
| Maintenance | actively maintained — 306 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: schema-0.7.8-py2.py3-none-any.whl
Keywords: schema, json, validation
About schema
from the package's own PyPI description — quoted content, verbatim
Schema validation just got Pythonic
schema is a library for validating Python data structures, such as those obtained from config-files, forms, external services or command-line parsing, converted from JSON/YAML (or something else) to Python data-types.
.. image:: https://secure.travis-ci.org/keleshev/schema.svg?branch=master :target: https://travis-ci.org/keleshev/schema
.. image:: https://img.shields.io/codecov/c/github/keleshev/schema.svg :target: http://codecov.io/github/keleshev/schema
Example
Here is a quick example to get a feeling of schema, validating a list of entries with personal information:
.. code:: python
from schema import Schema, And, Use, Optional, SchemaError
schema = Schema(
[
{
"name": And(str, len),
"age": And(Use(int), lambda n: 18 <= n <= 99),
Optional("gender"): And(
str,
Use(str.lower),
lambda s: s in ("squid", "kid"),...
Read as markdown · JSON record · Source repository · Homepage
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Schema provides lightweight, Pythonic validation of data structures (dicts, lists, tuples) against declarative schemas, with support for type checking, callable predicates, and data transformation via Use and Regex validators.
Installation is straightforward with low friction—a pure-Python wheel with only contextlib2 as a runtime dependency. The project maintains active status with recent releases and 2945 GitHub stars, though the last commit date (2026-06-20) appears anomalous and warrants verification.
Schema is licensed under MIT (permissive), meaning you can use, modify, and distribute it freely in both open-source and commercial projects with minimal restrictions.
Usage
pip install schema
from schema import Schema, And, Use, Optional, SchemaError
schema = Schema({"name": And(str, len), "age": And(Use(int), lambda n: 18 <= n <= 99)})
validated = schema.validate({"name": "Sue", "age": "28"})
Verdict: Schema is a mature, well-maintained validation library suitable for production use. It has no known vulnerabilities, minimal dependencies, and a permissive MIT license. The pure-Python implementation and broad Python version support (3.6–3.11, PyPy) make it easy to integrate. The anomalous future-dated last commit should be clarified before critical deployments.
Needs verification
- Clarify the 2026-06-20 last commit date—whether this is a data error or indicates actual future development
- Confirm whether the package actively maintains Python 3.10+ support despite Development Status :: 3 - Alpha classifier
Similar packages
permissive · top 1,000 on PyPI
aws-sam-translatorpermissive · top 1,000 on PyPI
typing-inspectpermissive · top 1,000 on PyPI
jiterpermissive · top 1,000 on PyPI
rfc3339-validatorpermissive · top 1,000 on PyPI
openapi-schema-validatorpermissive · top 1,000 on PyPI
texttablepermissive · top 1,000 on PyPI
fastjsonschemapermissive · top 1,000 on PyPI
regexpermissive · top 100 on PyPI
cramjampermissive · top 1,000 on PyPI