Registry / serialization / pymantic

pymantic

JSON →
library1.0.1pypypiunverified

Pymantic is a Semantic Web and RDF library for Python, providing parsers, serializers, and SPARQL client support. The latest version is 1.0.1 (released 2024) with slow release cadence. It supports RDF/XML, Turtle, JSON-LD, TriG, and N-Triples formats.

pip install pymantic
INSTALL
IMPORT
SIG · PYMANTIC
P
pymantic
serializationpythonv1.0.1
Install
3.7s avg
Import
Disk
42MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 43.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.7s · import 0.000s · 44MB
42MB installed
● package 42MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SPARQLClient
from pymantic.sparql import SPARQLClient
from pymantic import SPARQLClient

Basic usage: parse a Turtle file and query a SPARQL endpoint.

from pymantic.io import Graph from pymantic.sparql import SPARQLClient # Create a graph and parse a Turtle file graph = Graph() graph.parse('example.ttl', format='turtle') print(f"Parsed {len(graph.triples)} triples") # Query a SPARQL endpoint client = SPARQLClient('http://dbpedia.org/sparql') results = client.query('SELECT * WHERE {?s ?p ?o} LIMIT 10') for result in results['results']['bindings']: print(result)
Debug
Known issues
breakingVersion 1.0.0 dropped Python 2.x support and restructured packaging. Import paths changed from old patterns like `from pymantic import sparql`.
fix
Use `from pymantic.sparql import SPARQLClient` etc. Update imports per new package structure.
affects: >=1.0.0
deprecatedThe `lepl`-based parsers were replaced by `lark` in v0.2.0. Old code relying on `lepl` behavior may break.
fix
Ensure you use compatible syntax; lark may have stricter parsing. Update Turtle files if needed.
affects: >=0.2.0
gotchaParsing JSON-LD requires the `json-ld` optional dependency? Actually the library supports JSON-LD but may need `PyYAML` or extra care. Check documentation for exact parsing options (e.g., base URI).
fix
Install `PyYAML` if needed: `pip install PyYAML`. Use `graph.parse('file.jsonld', format='json-ld')`.
affects: all
Upgrade
Version history
1.0.1latest on PyPI · released Oct 2, 2025
Audit
Dependencies
larkrequiredParsing library used for Turtle and other RDF syntaxes
PyYAMLoptionalYAML support for configuration
requestsoptionalHTTP client for SPARQL endpoints
Agent activity
18 hits · last 30 days
node
18
Resources
pymantic — pip install pymantic · libregistry