skillfed

ShExJSG

ShExJSG - Astract Syntax Tree Definition for the ShEx 2.0 language

shexjsg v0.9.0 290.4K downloads/30d#7,989 on PyPI
Permissive license CC0 1.0 Universal Active released

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 shexjsg

uv

uv add shexjsg

poetry

poetry add shexjsg

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: CC0 1.0 Universal (CC0 1.0) Public Domain DedicationProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Compilers

Tags

shex schema python astshape expression languageshex validation pythonsemantic web schemardf shape constraints
semantic-webrdfschema-validation

More Compilers packages