Oxley: Building Pydantic classes from JSONschema at runtime

I’ve just pushed version 0.0.1 of Oxley, a Python package that ingests JSONschema and dynamically constructs Pydantic classes and their attendant features, including runtime data validation, schema generation, and interoperability with web frameworks like FastAPI. This is the first package I’ve published on PyPI that I’ve entirely self-produced, and I’m excited to see where it goes.

The niche is a simple one: data streams are places of chaos, but forcing adherance to external schemas can ensure some kinds of correctness and enhance interoperability with other sources. JSONschema is a pretty good framework for writing schema definitions, and some solutions (e.g. Python-JSONschema-Objects) enable easy and relatively well-featured runtime validation in Python environments. To my knowledge, though, Oxley is the first to employ Pydantic in this validation structure, which is great if you’re working on something like a FastAPI endpoint (as we often do in the Wagner lab). Even beyond standing up APIs, Pydantic has cemented itself as a Python developer favorite, and I think targeting its core functionality makes sense for fully fleshing out the possibilities of validation-by-schema.

My current feature target is to fully represent everyting in the Variant Representation Specification, but I’m also interested in covering other components of the 2020 spec (and earlier iterations as well, eventually). Pull requests welcome.