skillfed

PyLD

Python implementation of the JSON-LD API

pyld v3.1.0 358.4K downloads/30d#7,261 on PyPI678
Permissive license BSD 3-Clause license Active released

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 pyld

uv

uv add pyld

poetry

poetry add pyld

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonTopic :: InternetTopic :: Software Development :: Libraries

Tags

json-ld processor pythonlinked data json transformationjson-ld compact expand framerdf dataset canonicalizationsemantic json processingjson-ld w3c implementationlinked data context resolution
linked-datasemantic-webw3c-standard

More Libraries packages