pyKwalify

YAML and JSON schema validation library, a Python port of Kwalify

Library
PyPI
v1.8.0
299stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community76
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture76
Code Quality74
Innovation68
Learning Curve78

pyKwalify is a YAML/JSON schema validation library for Python, a port of the Java Kwalify framework with substantial added functionality. It validates data files against a declarative schema that describes the expected types, structure, and constraints, letting you catch malformed configuration or data before it reaches your application.

Schemas and data can both be written in YAML or JSON, and validation runs either from the command line (pykwalify -d data.yaml -s schema.yaml) or programmatically through its Core API. It ships with ruamel.yaml as its default parser for solid YAML 1.2 support.

What You Get

  • Declarative YAML/JSON schema validation with a rich keyword vocabulary
  • Both YAML and JSON supported for schema and data files
  • A command-line interface for validating files directly
  • A programmatic Core API for validating data inside your application
  • ruamel.yaml as the default parser for YAML 1.2 support
  • Extensive example schemas covering passing and failing cases in the test suite

Common Use Cases

  • Validating application configuration files before startup
  • Enforcing structure on YAML/JSON data in CI pipelines
  • Checking user- or machine-generated data against expected schemas
  • Documenting and asserting the shape of complex config formats

Under The Hood

Architecture - The heart of pyKwalify is the Core class, which loads a data document and a schema document, then recursively walks the schema rules against the data. Each schema node is turned into a Rule object encoding its type and constraints (sequence, mapping, required, pattern, range, enum, etc.), and validation traverses both trees in parallel, accumulating errors that pinpoint the failing path. The CLI is a thin wrapper that constructs a Core from -d/-s arguments.

Tech Stack - The library is pure Python and depends on ruamel.yaml as its default YAML parser (chosen for stronger YAML 1.2 support and active development), plus docopt for CLI argument handling. It is a port and extension of the Java/Ruby Kwalify schema language.

Code Quality - The project is mature (created 2013, 21 releases) with an extensive corpus of example schema/data files under tests/files/success and tests/files/fail that double as regression tests and documentation. It is currently low-activity, with the last release in 2020.

API Design - Schemas are written declaratively in YAML/JSON, which keeps them readable and version-controllable, and the programmatic entry point is a single Core(source_data=..., schema_data=...).validate() call. The keyword vocabulary is broad, so the main learning cost is understanding the available rule keywords, for which the bundled example files are the most useful reference.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search