Registry / serialization / serial

serial

JSON →
library0.0.97pypypiunverified

The `serial` library provides a framework for simple and powerful serialization and deserialization of Python class instances to and from various data formats like JSON, YAML, and XML. It leverages schema definitions for robust type handling and validation. The current version is 0.0.97, and it maintains an active development pace, though it is still in a pre-1.0 state.

pip install serial
INSTALL
IMPORT
SIG · SERIAL
S
serial
serializationpythonv0.0.97
Install
2.0s avg
Import
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.97 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 24.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.0s · import 0.000s · 26MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Serializer
from serial import Serializer
from serial import Serializer
serial
import serial

This quickstart demonstrates how to define a schema using `serial.fields`, instantiate `Serializer` and `Deserializer` for JSON format, and then serialize a Python dictionary into JSON and deserialize it back. It showcases basic schema validation and default value handling.

from serial import Serializer, Deserializer, fields import json # Define a schema for a simple User object user_schema = { "id": fields.Integer(required=True), "name": fields.String(required=True), "email": fields.Email(required=False), "is_active": fields.Boolean(default=True) } # Create a serializer instance for JSON user_serializer = Serializer(user_schema, format="json") # Create a deserializer instance for JSON user_deserializer = Deserializer(user_schema, format="json") # Example data to serialize user_data = {"id": 1, "name": "Alice Wonderland", "email": "alice@example.com"} # Serialize the data serialized_output = user_serializer.serialize(user_data) print(f"Serialized JSON: {serialized_output}") # Deserialize the data deserialized_object = user_deserializer.deserialize(serialized_output) print(f"Deserialized Object: {deserialized_object}")
Debug
Known issues
gotchaThis `serial` library for data serialization is distinct from `pyserial` (often imported as `serial`), which is used for serial port communication. Users frequently confuse the two due to the similar package name.
fix
Always confirm the purpose of the library when importing `serial`. If you need serial port communication, install `pyserial` and import `import serial` (it's confusing!). If you need data serialization, install `serial` and import `from serial import Serializer` etc.
affects: All versions
breakingThe library is in a pre-1.0 state (version 0.0.x), which means breaking changes can occur between minor or even patch versions without adhering to strict semantic versioning.
fix
Pin your dependency to an exact version (`serial==0.0.97`) to avoid unexpected breakages. Regularly check the GitHub repository for release notes before upgrading.
affects: < 1.0.0
gotchaSchema validation errors, such as missing required fields or type mismatches, are raised as `serial.exceptions.ValidationError` exceptions.
fix
Wrap serialization/deserialization calls in `try...except serial.exceptions.ValidationError` blocks to gracefully handle invalid input data. Implement client-side validation where possible to prevent these errors.
affects: All versions
Upgrade
Version history
0.0.97latest on PyPI · released Jan 30, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
14
Resources
serial — pip install serial · libregistry