--- id: schema version: "0.7.8" license: MIT license_treatment: permissive maintenance: active --- # schema — Simple data validation library License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install schema uv add schema poetry add schema ## Description 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"),... ## AI interpretation — verify before relying 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. 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. [View on SkillFed](https://skillfed.io/packages/schema) · [View on PyPI](https://pypi.org/project/schema/)