A Python package that standardizes data serialization and deserialization from/to pydantic models.
Project description
pydantic-serdes
pydantic-serdes is a Pydantic-based tool designed to act as a conduit between serialized data and Python objects. It not only facilitates the transformation of complex serialized data into Python objects, but also ensures stringent data validation. Think of it as the wizard that transports your data from the realm of serialization into the world of Python, and vice-versa, all the while maintaining the integrity and structure of your data.
DISCLAMER: Please note that this package was previously named
serial_bus
until version 0.2.0. To improve communication and disambiguation, it has been renamed topydantic-serdes
.
Install
pip:
pip install pydantic-serdes
poetry:
poetry add pydantic-serdes
Features
-
Pydantic Integration: Converting serialized data into Python objects is the oldest trick in the book, but pydantic-serdes elevates this process by directly converting the data into Pydantic models (and vice-versa), which brings the added advantage of robust data validation. The models used in this process are defined by classes that inherit from either the PydanticSerdesBaseModel or PydanticSerdesRenderableModel. This not only provides flexibility in setting up behaviors for your data, but also ensures data integrity through Pydantic's validation mechanisms.
-
Built-in Support for Multiple Formats: Currently, it supports loading serialized data from JSON, YAML, TOML and INI. While future support for other formats is planned, if you need to cover additional formats, or even provide your own parsing business logic, this can be easily achieved by extending pydantic-serdes basic coverage with your own loader and/or dumper functions. Speaking of which...
-
Extensibility: The code was thought to allow for ease of extensibility. For more information and examples, refer to the documentation below.
Quick Start
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
File details
Details for the file pydantic_serdes-1.0.1.tar.gz
.
File metadata
- Download URL: pydantic_serdes-1.0.1.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.11.6 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 067bdfa0177a0e3430b0233674b39515dba32be17b6447d5b38ba6a9395595dd |
|
MD5 | b151f791a12c9c22d7c558004d4570e0 |
|
BLAKE2b-256 | a5a56819e4dc89d201343cf5761fc9871f1aeb362f726df3583c853f87d19914 |
File details
Details for the file pydantic_serdes-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: pydantic_serdes-1.0.1-py3-none-any.whl
- Upload date:
- Size: 20.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.11.6 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 985a5ff93bd4c39410ba34593bf3f55cdbf1630a2bdebf27ac34520b8bd9602d |
|
MD5 | bce32d0853b0971d5b2e23f5a14401fa |
|
BLAKE2b-256 | e7c6de0e1a38c1b8893c75656a796e8d64a83c90a7be2f5f8c5b9f188dc60786 |