PyLD
Python implementation of the JSON-LD API
What it is and what it does
PyLD is a Python library that implements the JSON-LD 1.1 specification and related W3C recommendations for processing Linked Data in JSON. It provides core operations to transform JSON documents: compact (reduce verbosity using a context), expand (make all IRIs explicit), flatten (normalize nested structures), frame (reshape to a template), and normalize (create a canonical form for comparison or hashing). The library depends on cachetools for memoization, frozendict for immutable dictionaries, and lxml for XML processing.
The package is designed for applications that need to add semantic meaning to JSON, interoperate with RDF systems, or work with structured data formats like Microformats and Microdata. It includes a FrozenDocumentLoader for air-gapped deployments that prevents remote context fetches, and supports custom document loaders via Requests or aiohttp for production environments. The library aims for W3C spec conformance and is actively maintained.
Use it for:
- Compact verbose JSON-LD documents using a context to make them more readable and reduce payload size
- Expand JSON-LD to explicit form for RDF processing, semantic analysis, or interoperability with linked data systems
- Normalize documents to a canonical form for content hashing, deduplication, or cryptographic signing
- Frame JSON-LD documents into a specific tree structure for application-specific data models
- Validate and process ActivityStreams, Verifiable Credentials, or DID documents using bundled W3C contexts
- Build semantic web services that need to handle multiple structured data formats (Microdata, RDFa, Microformats)
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyLD is a Python implementation of the JSON-LD specification that transforms, expands, compacts, frames, and normalizes JSON-LD documents according to W3C standards.
Yes. PyLD is a mature, actively maintained implementation of a W3C standard with no known vulnerabilities, low install friction, and a permissive license. Install it if you need to process JSON-LD documents, work with linked data, or add semantics to JSON. The FrozenDocumentLoader and optional async support make it suitable for both development and production use.
Install
pyld on PyPI
pip
pip install pylduv
uv add pyldpoetry
poetry add pyldInstalling PyLD
Before you install
Low install friction with a pure-wheel distribution. Actively maintained with a recent release; the repository is not archived and has received commits. Three runtime dependencies (cachetools, frozendict, lxml) are all stable, widely-used libraries.
License in practice
BSD 3-Clause is a permissive license. You can use, modify, and distribute PyLD with minimal restrictions, provided you include the license notice and disclaimer.
Quickstart
pip install PyLD
from pyld import jsonld
import json
doc = {"http://schema.org/name": "Example"}
context = {"name": "http://schema.org/name"}
compacted = jsonld.compact(doc, context)
print(json.dumps(compacted, indent=2))
Verify before relying
- Whether Python 3.10 or later is strictly required (requires_python field is unspecified in the fact sheet)
- Performance characteristics and memory footprint for large or deeply nested documents
- Whether remote context fetching is enabled by default and what security implications that carries
Package facts
| License | BSD 3-Clause license (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — cachetools, frozendict, lxml |
| Maintenance | actively maintained — 56 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 358,441/month — #7,261 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyld-3.1.0-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
extructExtracts structured metadata from HTML markup…
permissive · top 15,000 on PyPI
rdflib-jsonldProvides JSON-LD parsing and serialization for…
permissive · top 15,000 on PyPI
provImplements the W3C PROV Data Model in Python,…
permissive · top 15,000 on PyPI
rdflibRDFLib is a Python library for parsing,…
permissive · top 1,000 on PyPI
pyrdfa3Parses RDFa markup embedded in HTML documents…
unclear · top 15,000 on PyPI
schema-saladSchema Salad is a schema language for…
permissive · top 15,000 on PyPI
linkmlLinkML is a modeling language for defining…
permissive · top 15,000 on PyPI
pyoxigraphPyoxigraph is a Python library that provides…
permissive · top 15,000 on PyPI
json-flattenConverts nested JSON objects into flat…
permissive · top 15,000 on PyPI
jsondiffComputes structured diffs between JSON and…
permissive · top 5,000 on PyPI