{"id":21793,"library":"pyshexc","title":"PyShExC - Python ShEx Compiler","description":"PyShExC compiles Shape Expressions (ShEx) schemas into Python executable shapes. Version 0.9.1 supports ShEx 2.1 grammar, requires Python >=3.7, and is released irregularly.","status":"active","version":"0.9.1","language":"python","source_language":"en","source_url":"https://github.com/shexSpec/grammar-python-antlr","tags":["shex","shapes","rdf","compiler","antlr"],"install":[{"cmd":"pip install pyshexc","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"runtime dep for ANTLR grammar parsing","package":"antlr4-python3-runtime","optional":false}],"imports":[{"note":"compile_shex is in pyshexc.parser module, not top-level","wrong":"from pyshexc import compile_shex","symbol":"compile_shex","correct":"from pyshexc.parser import compile_shex"},{"note":null,"wrong":null,"symbol":"ShExCVisitor","correct":"from pyshexc.parser import ShExCVisitor"}],"quickstart":{"code":"from pyshexc.parser import compile_shex\n\nshex_schema = \"\"\"\nPREFIX ex: <http://example.org/>\nex:User IRI {\n  ex:name xsd:string ;\n  ex:email xsd:string\n}\n\"\"\"\n\ntry:\n    compiled = compile_shex(shex_schema)\n    print(\"Schema compiled successfully\")\n    print(type(compiled))\nexcept Exception as e:\n    print(f\"Compilation error: {e}\")","lang":"python","description":"Compile a ShEx schema string into a Python object using compile_shex."},"warnings":[{"fix":"with open('schema.shex') as f: compile_shex(f.read())","message":"compile_shex expects a ShEx schema string, not a file path. To read from file, open and read the file yourself.","severity":"gotcha","affected_versions":"all"},{"fix":"from pyshexc.parser import compile_shex","message":"The top-level function 'compile' (from pyshexc) is deprecated; use 'compile_shex' from pyshexc.parser instead.","severity":"deprecated","affected_versions":">=0.9.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"pip install antlr4-python3-runtime","cause":"Missing runtime dependency antlr4-python3-runtime.","error":"ModuleNotFoundError: No module named 'antlr4'"},{"fix":"Use from pyshexc.parser import compile_shex instead.","cause":"Using deprecated import path: from pyshexc import compile.","error":"AttributeError: module 'pyshexc' has no attribute 'compile'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}