PyShexC
PyShExC - Python ShEx compiler
What it is and what it does
PyShExC is a Python compiler for the Shape Expression Compact (ShExC) syntax, originally developed by Eric Prud'hommeaux and now maintained in the LinkML organization. It parses ShExC text into pyjsg Python objects, which can then be serialized to ShEx JSON (ShExJ) or RDF (ShExR) representations. The package is designed for developers who need to work with shape definitions programmatically—either to validate RDF data against shape constraints, transform between ShEx formats, or build ShEx-based tools.
The package includes a command-line tool (shexc_to_shexj) for converting ShExC files to JSON and RDF outputs, plus a Python API for programmatic access. It depends on ANTLR4 for parsing, rdflib-shim for RDF operations, and several related libraries (jsonasobj, pyjsg, shexjsg) that handle the object model and JSON schema bindings. The fork was created to enable Python 3.14 support in LinkML after the original repository became inactive.
Use it for:
- Convert ShExC shape definitions to ShEx JSON format for use in web applications or APIs.
- Programmatically validate RDF graphs against shape constraints by parsing ShExC schemas.
- Transform shape definitions between ShExC, ShExJ, and ShExR formats in data pipeline tools.
- Build custom ShEx interpreters or validators that require parsed shape objects as input.
- Integrate shape validation into linked data workflows that use Python.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses Shape Expression Compact (ShExC) syntax into Python objects that can be serialized to ShEx JSON (ShExJ) or RDF (ShExR) formats, enabling programmatic validation and transformation of shape definitions.
Yes, if you need to parse or transform ShEx shape definitions in Python. The package is actively maintained, has low install friction, carries no security vulnerabilities, and supports current Python versions (3.10–3.14). The MIT license imposes no restrictions. Install only if you are working with ShEx schemas; it is a specialized tool with no general-purpose utility.
Install
pyshexc on PyPI
pip
pip install pyshexcuv
uv add pyshexcpoetry
poetry add pyshexcInstalling PyShexC
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained as of the latest release, with support for modern Python versions (3.10–3.14). Six runtime dependencies are all standard ecosystem packages.
License in practice
MIT License permits commercial and private use with minimal restrictions; attribution required but no copyleft obligations.
Quickstart
pip install PyShExC
from pyshexc import ShExC
parser = ShExC()
shex_obj = parser.parse_file('schema.shex')
print(shex_obj.to_json())
Requires Python 3.10 or later.
Verify before relying
- Whether the package is actively maintained by LinkML organization or if it remains a one-time fork for Python 3.14 support only.
- Performance characteristics when parsing large or complex ShExC schemas.
- Completeness of ShEx 2.1 specification coverage beyond the test suite mentioned.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — antlr4-python3-runtime, chardet, jsonasobj, pyjsg, rdflib-shim, shexjsg |
| Maintenance | actively maintained — 105 days since the last release |
| First released | |
| Downloads | 302,316/month — #7,825 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyshexc-0.10.3.post1-py3-none-any.whl
Keywords: rdf, shex, shexc, shexj, shexr
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
PyShExPyShEx parses and validates RDF data against…
permissive · top 15,000 on PyPI
ShExJSGShExJSG provides a Python object model for the…
permissive · top 15,000 on PyPI
PyJSGGenerates Python 3 classes from JSON Schema…
permissive · top 15,000 on PyPI
pyshaclValidates RDF graphs against SHACL shape…
permissive · top 5,000 on PyPI
rdflib-jsonldProvides JSON-LD parsing and serialization for…
permissive · top 15,000 on PyPI
rdflibRDFLib is a Python library for parsing,…
permissive · top 1,000 on PyPI
xmlschemaValidates XML documents against XSD schemas and…
permissive · top 5,000 on PyPI
extructExtracts structured metadata from HTML markup…
permissive · top 15,000 on PyPI
xsdata-pydanticGenerates pydantic models from XML and JSON…
permissive · top 15,000 on PyPI
sssomParse, validate, and convert SSSOM (Simple…
permissive · top 15,000 on PyPI