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
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
pydantic-kedro-0.1.2.tar.gz
(19.7 kB
view hashes)
Built Distribution
Close
Hashes for pydantic_kedro-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e05f8075bd3a9b8ce582bbe75b4a307114cd94826dd9f8e88d18a7878404b39 |
|
MD5 | 878edeb79b098a2f6cb28b614a8b7bc0 |
|
BLAKE2b-256 | d1276674af24a7ec9fb3068b8eeee1416004ae5ec29022f92011994aaad7508c |