skillfed

PyShexC

PyShExC - Python ShEx compiler

pyshexc v0.10.3.post1 302.3K downloads/30d#7,825 on PyPI
Permissive license MIT License Active released

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 pyshexc

uv

uv add pyshexc

poetry

poetry add pyshexc

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming 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 parser pythonshexc to shexj convertershape expression compilerrdf shape validationshex json serialization
rdf-semantic-webschema-validationcompiler

More Compilers packages