Skip to main content

pydantic-jsonld

CI codecov Python 3.11 uv Ruff mypy MkDocs License: MIT

pydantic-jsonld is a light-weight Python package that aims to make use of pydantic for JSON-LD data.

What this is not: This package offers no functionality for compaction or expansion. Neither does it parse any given context.

Installation

pip install pydantic-jsonld

Documentation

See Pydantic JSON-LD Docs.

Structure

This package offers two BaseModel implementations derived from pydantic. One for working with compacted JSON-LD data and one for expanded JSON-LD data.

Since there is no implementation of context parsing, the compacted model includes several limitations.

This is, however, a design choice as to avoid the necessity of fetching external contexts as well as the heavy computation that comes with validating JSON-LD data.

Usage

For the most basic usage, see the following example

from pydantic_jsonld.compact import BaseModel, Value


# Define a model
class MyModel(BaseModel):
    height: Value[float]
    length: Value[float]


# Build an instance from JSON-LD data
data = {
    "@context": {"@vocab": "http://www.example.org/"},
    "height": 20.0,
    "length": 10.0,
}
model = MyModel.model_validate(data)

# Access via model properties
assert model.height.value == 20.0
assert model.length.value == 10.0

# Recover the original data
dumped = model.model_dump(by_alias=True, exclude_none=True)
assert dumped == data

License

This project is licensed under the MIT License.

Metadata

Release files for pydantic-jsonld 0.1.0

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

Source distribution (sdist)

Source distribution for pydantic-jsonld 0.1.0
File Size Uploaded Provenance Actions
pydantic_jsonld-0.1.0.tar.gz 12.0 kB With provenance Details for pydantic_jsonld-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-jsonld 0.1.0
File Interpreter ABI Platform Actions
pydantic_jsonld-0.1.0-py3-none-any.whl Python 3 none any Details for pydantic_jsonld-0.1.0-py3-none-any.whl

Total release size: 28.1 kB

Release files / pydantic_jsonld-0.1.0.tar.gz

Download URL pydantic_jsonld-0.1.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dcb029a8ef03d4d76147de2a34a37b22abe35b46bc6ab25c486b937da70b61e7
BLAKE2b-256 checksum
How to use checksums
b49278725c4c5e91f8843c0ba5a90364e90d3129788339099b060716e2fdaa8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 23, 2026.

Transparency log

Release files / pydantic_jsonld-0.1.0-py3-none-any.whl

Download URL pydantic_jsonld-0.1.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
578c6af0662e0f3532bb04f0ca8416c6a83bf5bc7f6aaed7da61263c55930d92
BLAKE2b-256 checksum
How to use checksums
738f80c7b04321644a2e8b8291da9e673eb7284b3829c3f726e976d2cfa04f14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 23, 2026.

Transparency log

Security for pydantic-jsonld 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydantic_jsonld-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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