schema
Simple data validation library
Decision gist · record as of 2026-08-14
Yes. Schema is a stable, widely-used (28M+ monthly downloads, top 1000 PyPI), permissively licensed library with no known vulnerabilities and low install friction. It solves a common problem—validating unstructured data—with a clean, Pythonic API. Install it if you need to validate incoming data structures in any form.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel, single runtime dependency (contextlib2), active maintenance with last commit 2026-06-20, and no known vulnerabilities.
License · maintenance · safety
MIT (permissive) — MIT license (permissive); you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2025-10-11 (307 days) · last repo commit 2026-06-20 · 2,945 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 28,552,508 downloads/mo, #834 on PyPI
Alternatives
Verify before relying
pip install schema
from schema import Schema, And, Optional
schema = Schema({"name": str, Optional("age"): And(int, lambda n: 18 <= n <= 99)})
validated = schema.validate({"name": "Sue", "age": 28})- Whether contextlib2 is a runtime dependency for all Python versions or only for older versions (fact sheet does not specify version-conditional dependency).
What it is and what it does
Schema is a lightweight validation library that lets you define what shape your data should have, then checks incoming data (from JSON, YAML, forms, APIs, or config files) against that shape. You write schemas declaratively using Python types, callables, and special validators like And, Use, Optional, and Regex, then call schema.validate(data) to either get back the validated data (with optional transformations applied) or catch a SchemaError if validation fails.
The library handles nested structures—dicts with required and optional keys, lists and tuples with element constraints, and custom validation logic via lambdas or callable objects. It's designed for the common case of validating untrusted or loosely-typed input before you use it in your application, with support for type coercion (e.g., converting string "123" to int 123) and conditional validation rules.
Use it for
- Validate configuration files (YAML/JSON) before passing them to application logic.
- Check and coerce form or API request data to ensure it matches expected types and constraints.
- Validate command-line arguments or environment variables converted to Python dicts.
- Enforce structure on data from external services before processing or storing it.
- Build data pipelines where each stage validates its input against a schema before transformation.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Schema is a stable, widely-used (28M+ monthly downloads, top 1000 PyPI), permissively licensed library with no known vulnerabilities and low install friction. It solves a common problem—validating unstructured data—with a clean, Pythonic API. Install it if you need to validate incoming data structures in any form.
Install
schema on PyPI
Before you install
Low friction: pure Python wheel, single runtime dependency (contextlib2), active maintenance with last commit 2026-06-20, and no known vulnerabilities.
License in practice
MIT license (permissive); you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install schema
from schema import Schema, And, Optional
schema = Schema({"name": str, Optional("age"): And(int, lambda n: 18 <= n <= 99)})
validated = schema.validate({"name": "Sue", "age": 28})
Verify before relying
- Whether contextlib2 is a runtime dependency for all Python versions or only for older versions (fact sheet does not specify version-conditional dependency).
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagecontextlib2 |
| Maintenance | Actively maintained 307 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 28,552,508 / month, #834 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Utilities |
Evidence: schema-0.7.8-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “dict and list validation”
- schemaValidates Python data structures (dicts, lists, tuples) against…
- voluptuousVoluptuous validates Python data structures (dictionaries, lists,…
- serpyco-rsSerializes and deserializes Python dataclasses to/from dictionaries,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also avro-validator · pandas-schema · pytest-schema · schematics · trafaret · warlock · pandera · voluptuous · xmlschema · yamale