Skip to main content

activitypub-linked-data

Local JSON-LD context loader and RDF namespace definitions for ActivityPub and the Fediverse

activitypub-linked-data is a Python utility package that provides preloaded JSON-LD context documents and RDF namespace constants for use in ActivityPub implementations and other Fediverse-compatible applications. It includes a built-in JSON-LD document loader optimized for speed, reliability, and offline use.

Features

  • Local resolution of common JSON-LD context URLs used in the Fediverse
  • Built-in rdflib namespaces for ActivityStreams, Security and Identity vocabularies
  • Secure document loader to replace remote HTTP fetching
  • Compatible with rdflib and pyld JSON-LD processing
  • Designed for use in Fediverse applications, including servers and identity tools

Installation

pip install activitypub-linked-data

Usage

from pyld import jsonld

from ap.linked_data import AS2, setup_rdflib_local_handler, jsonld_local_document_loader

if __name__ == '__main__':
    setup_rdflib_local_handler() # Patches rdflib to use locally defined contexts, when available.

    # Sets up jsonld to use local context documents
    jsonld.set_document_loader(jsonld_local_document_loader)

    # Use a namespace
    print(AS2.Person)  # -> https://www.w3.org/ns/activitystreams#Person

Note: pyld is not declared as a dependency. You need to include in your own project if you wish to use jsonld_local_document_loader

Attribution

This package is derived from the Takahē project, which is licensed under the BSD 3-Clause License.

Metadata

Release files for activitypub-linked-data 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for activitypub-linked-data 0.0.1
File Size Uploaded
activitypub_linked_data-0.0.1.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for activitypub-linked-data 0.0.1
File Interpreter ABI Platform
activitypub_linked_data-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / activitypub_linked_data-0.0.1.tar.gz

Download URL activitypub_linked_data-0.0.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d93d2f4fad91d69f2d775ce3996ee15bfa4d763a2c729967d4b3b948c85321e3
BLAKE2b-256 checksum
How to use checksums
06947a5c39d7210e3bb8b7dd734237e905a273dbe398a7292d1c59dc9c5b6f16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release files / activitypub_linked_data-0.0.1-py3-none-any.whl

Download URL activitypub_linked_data-0.0.1-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d2aa266ff1e6fdc365631dee2c67eff23477a93e758cf52b36279c6a7c7907a
BLAKE2b-256 checksum
How to use checksums
750db306537b76cbbd07aede8c13a80e3ae912425dd3b8c83a3a9078994296a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page