ShExJSG
ShExJSG - Astract Syntax Tree Definition for the ShEx 2.0 language
What it is and what it does
ShExJSG is a Python library that implements the ShEx 2.0 Abstract Syntax Tree specification, letting you work with Shape Expressions—a language for validating RDF graph structure—as native Python objects. It was originally developed by Harold Solbrig and contributed to the LinkML organization.
The library lets you construct ShEx schemas programmatically, validate them, and serialize them to JSON or other formats. It depends on pyjsg, a code generator that produces Python classes from JSG (JSON Schema Grammar) specifications. The package is actively maintained, supports Python 3.10 through 3.14, and carries no known security vulnerabilities.
Use it for:
- Build ShEx schemas programmatically in Python instead of writing raw JSON or ShExC syntax.
- Validate RDF graph structures against shape constraints defined in ShEx.
- Convert between ShEx representations (Python objects, JSON, ShExC text format).
- Integrate ShEx validation into semantic web or linked data processing pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
ShExJSG provides a Python object model for the ShEx 2.0 Shape Expression language, allowing you to programmatically construct, validate, and serialize ShEx schemas as Python objects.
Yes, if you work with ShEx or RDF shape validation in Python. Low install friction, permissive license, active maintenance, and no known vulnerabilities make it a straightforward choice. The single dependency (pyjsg) is the only risk surface; verify its stability for your use case.
Install
shexjsg on PyPI
pip
pip install shexjsguv
uv add shexjsgpoetry
poetry add shexjsgInstalling ShExJSG
Before you install
Low friction: pure Python wheel with a single runtime dependency (pyjsg). Actively maintained with a recent release; requires Python 3.10 or later.
License in practice
Licensed under CC0 1.0 Universal (public domain dedication), permissive treatment means you can use, modify, and distribute freely with no attribution requirement.
Quickstart
from ShExJSG import Schema, ShExJ
from pyjsg.jsglib.loader import is_valid
schema = Schema()
schema.start = ShExJ.Shape()
print(is_valid(schema))
print(schema._as_json_dumps())
Requires Python 3.10 or later.
Verify before relying
- Whether pyjsg itself has known vulnerabilities or maintenance issues that would affect this package's reliability.
- Whether the circular dev dependency (pyshexc) documented in the README affects production use or only development workflows.
Package facts
| License | CC0 1.0 Universal (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyjsg |
| Maintenance | actively maintained — 102 days since the last release |
| First released | |
| Downloads | 290,446/month — #7,989 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: shexjsg-0.9.0-py3-none-any.whl
Keywords: jsg, rdf, shex
Tags
More Compilers packages
pyparsing provides a library for building text…
permissive · top 1,000 on PyPI
CythonCython is a source code translator that…
permissive · top 1,000 on PyPI
asttokensAnnotates Python abstract syntax trees with the…
permissive · top 1,000 on PyPI
numbaNumba is a just-in-time compiler that…
permissive · top 1,000 on PyPI
tree-sitterPython bindings to the tree-sitter parsing…
permissive · top 1,000 on PyPI
llvmlitellvmlite provides a lightweight Python binding…
permissive · top 1,000 on PyPI
PyJSGGenerates Python 3 classes from JSON Schema…
permissive · top 15,000 on PyPI
PyShExPyShEx parses and validates RDF data against…
permissive · top 15,000 on PyPI
PyShexCParses Shape Expression Compact (ShExC) syntax…
permissive · top 15,000 on PyPI
linkmlLinkML is a modeling language for defining…
permissive · top 15,000 on PyPI
pyshaclValidates RDF graphs against SHACL shape…
permissive · top 5,000 on PyPI
jsonasobjConverts JSON data into Python objects with…
permissive · top 15,000 on PyPI
jsonasobj2Converts JSON data into Python objects with…
permissive · top 15,000 on PyPI
sssomParse, validate, and convert SSSOM (Simple…
permissive · top 15,000 on PyPI
linkml-runtimeProvides runtime support for LinkML-generated…
permissive · top 15,000 on PyPI