PyShEx
Python ShEx interpreter
Decision gist · record as of 2026-08-14
Yes, with conditions. Install if you need to validate RDF against ShEx schemas and can tolerate that some unit tests are failing due to a long maintenance gap. The package is actively maintained now and supports current Python versions (3.10–3.14), but review the open issues and test manifest before relying on complex or edge-case validation logic. No known security vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- If using JSON-LD parsing, note that rdflib-jsonld is incompatible with the bleeding-edge rdflib version needed for single-quote escaping in RDF literals.
- Low install friction with a pure-Python wheel.
License · maintenance · safety
CC0 1.0 Universal (permissive) — Licensed under CC0 1.0 Universal (public domain dedication), placing no restrictions on use, modification, or distribution for any purpose.
last release 2026-05-07 (99 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 302,591 downloads/mo, #7,820 on PyPI
Alternatives
Verify before relying
pip install PyShEx
from pyshex.shex_evaluator import ShExEvaluator
evaluator = ShExEvaluator(rdf='data.ttl', shex='schema.shex')
result = evaluator.evaluate()- Whether all 81 skipped tests in the official test suite (52 bnode identity, 18 ShEx 2.1 IMPORT, 3 shapemap, 2 relative IRI, 6 rdflib quote escaping) affect real-world use cases.
- Current status of the rdflib single-quote escaping issue and whether a workaround is available without using bleeding-edge rdflib.
- Which specific unit tests are failing and whether they impact the validation semantics or only edge cases.
What it is and what it does
PyShEx is a Python implementation of the Shape Expressions Language 2.0 specification, allowing you to parse ShEx schemas (in both ShExC and ShExJ formats) and validate RDF graphs against them. It determines whether RDF nodes and their properties conform to the structural and type constraints defined in a ShEx schema, supporting features like SPARQL-based focus node selection, RDF Collections flattening, and detailed validation reporting.
The package wraps the formal ShEx specification closely in Python code, translating semantic rules directly into executable logic. It includes a command-line tool (shexeval) for batch validation and integrates with rdflib for RDF parsing and SPARQL endpoints. The package depends on ShExJSG for AST representation, pyshexc for ShExC parsing, and several RDF utilities (rdflib-shim, sparqlwrapper, sparqlslurper) to handle diverse RDF sources and query patterns.
Use it for
- Validate RDF data against organizational or domain-specific shape constraints before ingesting into a knowledge graph.
- Test RDF export pipelines to ensure generated triples conform to expected structural schemas.
- Query SPARQL endpoints and validate the results against ShEx schemas in a single workflow.
- Batch-validate large RDF files or multiple datasets using the shexeval CLI with focus node selection by type or predicate.
- Integrate shape validation into linked data publishing pipelines to catch schema violations early.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
Install if you need to validate RDF against ShEx schemas and can tolerate that some unit tests are failing due to a long maintenance gap. The package is actively maintained now and supports current Python versions (3.10–3.14), but review the open issues and test manifest before relying on complex or edge-case validation logic. No known security vulnerabilities.
Install
pyshex on PyPI
Before you install
Low install friction with a pure-Python wheel. Maintenance is active but the package carries a caveat: the current release was issued to support Python 3.14 after a long development hiatus, and some unit tests remain failing due to outdated code or genuine bugs—consult issues before relying on edge cases.
Requires Python 3.10 or later. If using JSON-LD parsing, note that rdflib-jsonld is incompatible with the bleeding-edge rdflib version needed for single-quote escaping in RDF literals.
License in practice
Licensed under CC0 1.0 Universal (public domain dedication), placing no restrictions on use, modification, or distribution for any purpose.
Quickstart
pip install PyShEx
from pyshex.shex_evaluator import ShExEvaluator
evaluator = ShExEvaluator(rdf='data.ttl', shex='schema.shex')
result = evaluator.evaluate()
Verify before relying
- Whether all 81 skipped tests in the official test suite (52 bnode identity, 18 ShEx 2.1 IMPORT, 3 shapemap, 2 relative IRI, 6 rdflib quote escaping) affect real-world use cases.
- Current status of the rdflib single-quote escaping issue and whether a workaround is available without using bleeding-edge rdflib.
- Which specific unit tests are failing and whether they impact the validation semantics or only edge cases.
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 | 9 packagescfgraphchardetpyshexcrdflib-shimrequestsshexjsgsparqlslurpersparqlwrapperurllib3 |
| Maintenance | Actively maintained 99 days since the last release |
| First released | |
| Downloads | 302,591 / month, #7,820 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: 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 |
Evidence: pyshex-0.9.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “ShEx validation RDF”
- PyShExPyShEx parses and validates RDF data against Shape Expressions (ShEx)…
- ShExJSGShExJSG provides a Python object model for the ShEx 2.0 Shape…
- PyShexCParses Shape Expression Compact (ShExC) syntax into Python objects…
Give your agent the search over MCP, or paste the wish link into any chat.
More Compilers packages
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
Cython is a source code translator that compiles Python code to C, enabling optional static typing and direct C/C++ interoperability to generate efficient native extensions.
Install it if you need to optimize Python performance, wrap C/C++ libraries, or build fast native extensions.
Annotates Python abstract syntax trees with the positions of tokens and source code text, enabling tools to map AST nodes back to their originating code for refactoring, analysis, and transformation.
Numba is a just-in-time compiler that accelerates numerically-focused Python code by compiling it to machine code via LLVM, with support for NumPy functions, loop parallelization, and GPU code generation.
Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.
llvmlite provides a lightweight Python binding to LLVM's IR builder, optimizer, and JIT compiler APIs, enabling you to write JIT compilers and code generators without needing the full LLVM C++ API surface.
See also PyShexC · ShExJSG · rdflib · pyshacl · CFGraph · linkml · pymantic · owlrl · pyrdfa3 · sssom