JSON-LD context loader and RDF schema definitions for ActivityPub
Project description
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
rdflibnamespaces for ActivityStreams, Security and Identity vocabularies - Secure document loader to replace remote HTTP fetching
- Compatible with
rdflibandpyldJSON-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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file activitypub_linked_data-0.0.1.tar.gz.
File metadata
- Download URL: activitypub_linked_data-0.0.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d93d2f4fad91d69f2d775ce3996ee15bfa4d763a2c729967d4b3b948c85321e3
|
|
| MD5 |
9e2f4edd256d35c654c9adbcfe2fd139
|
|
| BLAKE2b-256 |
06947a5c39d7210e3bb8b7dd734237e905a273dbe398a7292d1c59dc9c5b6f16
|
File details
Details for the file activitypub_linked_data-0.0.1-py3-none-any.whl.
File metadata
- Download URL: activitypub_linked_data-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d2aa266ff1e6fdc365631dee2c67eff23477a93e758cf52b36279c6a7c7907a
|
|
| MD5 |
7e5f00b56d3b0e4e10c18e9606c4c809
|
|
| BLAKE2b-256 |
750db306537b76cbbd07aede8c13a80e3ae912425dd3b8c83a3a9078994296a9
|