--- id: pyjsg version: "0.12.4" license: CC0 1.0 Universal license_treatment: permissive maintenance: active --- # PyJSG — Python JSON Schema Grammar interpreter License: permissive · Maintenance: active · Downloads: 292.4K/mo ## What it is and what it does PyJSG is a code generator that reads JSON Schema Grammar (JSG) specifications and produces Python 3 classes representing the schema's structure. It bridges the gap between declarative schema definitions and typed Python objects, using the typing library to provide IDE support and type hints. The generated classes inherit from JSG base types and include built-in validation, serialization to JSON, and attribute access control. You define a schema in JSG syntax, run the generate_parser command-line tool, and get back a Python module with classes ready to instantiate, populate, validate, and serialize. The package includes a validation library that checks whether Python objects conform to their schema definitions. Use it for: - Generate strongly-typed Python models from existing JSON Schema Grammar definitions for data interchange formats. - Build configuration file parsers that validate structure and types at runtime using generated schema classes. - Create domain-specific language interpreters where the grammar defines both syntax and Python object structure. - Validate JSON data against a schema before processing, catching structural errors early in a pipeline. - Serialize Python objects back to JSON while enforcing schema constraints and type safety. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates Python 3 classes from JSON Schema Grammar (JSG) specifications, enabling type-safe object representations of JSON data with validation and serialization support. Yes, if you work with JSON Schema Grammar and need type-safe Python bindings. The package is actively maintained, has no known vulnerabilities, installs cleanly, and is permissively licensed. The main consideration is whether your project already uses JSG; if you're starting fresh, evaluate whether JSG's grammar syntax fits your schema needs better than alternatives. ## Install pip install pyjsg uv add pyjsg poetry add pyjsg ## Installing PyJSG Before you install: Low install friction with a pure Python wheel distribution. Maintenance status is active with a recent release. Three runtime dependencies (antlr4-python3-runtime, jsonasobj, requests) are standard libraries in the Python ecosystem. License in practice: Licensed under CC0 1.0 Universal (public domain dedication), which is permissive and places no restrictions on use, modification, or distribution. Quickstart: pip install pyjsg generate_parser input.jsg from pyjsg.jsglib.jsg import loads schema_json = '{"type": "Schema"}' s = loads(schema_json) print(s._as_json_dumps()) Requires Python 3.10 or later; the package depends on internal features of the typing library which may require testing when upgrading Python versions. Verify before relying: - Current compatibility with Python 3.13 and 3.14 (listed as supported but package last released 2026-05-01) - Whether antlr4-python3-runtime introduces any platform-specific compilation requirements - Real-world validation performance and error message clarity for complex schemas ## Package facts - License: CC0 1.0 Universal (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 292.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags json schema grammar python, code generator json schema, jsg python bindings, json to python classes, schema validation python, typed json objects python, jsg parser generator, schema-validation, code-generation, json-schema [View on SkillFed](https://skillfed.io/packages/pyjsg) · [View on PyPI](https://pypi.org/project/pyjsg/)