Skip to main content

Kedro

Project description

pydantic-kedro

Advanced serialization for Pydantic models via Kedro and fsspec.

This package implements custom Kedro "datasets" for both "pure" and "arbitrary" Pydantic models.

Please see the docs for a tutorial and more examples.

Minimal Example

This example works for "pure", JSON-safe Pydantic models via PydanticJsonDataSet:

from pydantic import BaseModel
from pydantic_kedro import PydanticJsonDataSet


class MyPureModel(BaseModel):
    """Your custom Pydantic model with JSON-safe fields."""

    x: int
    y: str


obj = MyPureModel(x=1, y="why?")

# Create an in-memory (temporary) file via `fsspec` and save it
ds = PydanticJsonDataSet("memory://temporary-file.json")
ds.save(obj)

# We can re-load it from the same file
read_obj = ds.load()
assert read_obj.x == 1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic-kedro-0.2.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

pydantic_kedro-0.2.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file pydantic-kedro-0.2.0.tar.gz.

File metadata

  • Download URL: pydantic-kedro-0.2.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pydantic-kedro-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c14e9d74d08e7c62845f172bb4fd6c5d2e264d5c60c553fe5d9721d24713c46b
MD5 f721023beb9a72f39e670ba83fa07f13
BLAKE2b-256 bdd39a1331d8563b394afbd767ef0c8960a4024a0877b5eaab67e519dbe06a84

See more details on using hashes here.

File details

Details for the file pydantic_kedro-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_kedro-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c4fb8c9761df561ce7f86d3cbdd620efbde32c07218c943a1dbd8e990bc124a
MD5 050905e24812bbd2f2d7f084b132f90c
BLAKE2b-256 5096596872563cdf3d7bfc4c5800c069c1ce8fda6030fefcc0d09d482200d1d3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page