serify — Python worker library
Python worker library for serify, a cross-language serialization conformance harness.
You define a schema and test cases once; each target language ships a small
worker program that serializes and deserializes the data, and the serify
CLI drives every worker through the same cases and compares their output
byte-for-byte. This package is what a Python worker imports.
Install
pip install serify
Usage
@serify_model reads the dataclass annotations and generates the field-map
conversion. You supply the byte layout and register it per format:
from dataclasses import dataclass, field
from serify import Format, Type, run_suite, serify_model
@serify_model
@dataclass
class UserRecord:
user_id: int
username: str
score: float
email: str = field(default="", metadata={"serify": "email_addr"})
def marshal(self) -> bytes:
... # your byte layout
@classmethod
def unmarshal(cls, data: bytes) -> "UserRecord":
... # its inverse
if __name__ == "__main__":
run_suite({
"user": Type(UserRecord, {
"binary": Format(UserRecord.marshal, UserRecord.unmarshal),
}),
})
Field names map to schema keys as written; metadata={"serify": "key"} renames
one. Nested structs work by decorating the nested dataclass, and dict[str, X]
maps to map<string,X>.
run_suite takes over stdin/stdout to speak the NDJSON protocol the CLI drives,
so a worker's own output must go to stderr.
Documentation
Full documentation, the protocol spec, and reference workers for all nine languages live in the main repository.
License
Apache-2.0
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file serify-0.1.0.tar.gz.
File metadata
- Download URL: serify-0.1.0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1589a0ad1ee98421bf236977547c90772e7365273f89f68856007a340cc16c53
|
|
| MD5 |
27b90c5ebe47891ec9ed223a8bcfdaa5
|
|
| BLAKE2b-256 |
32b3c03adf1865dca3701245d1939d73156f901847023c14fe4ce673999127e0
|
Provenance
The following attestation bundles were made for serify-0.1.0.tar.gz:
Publisher:
release.yml on chengxilo/serify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
serify-0.1.0.tar.gz -
Subject digest:
1589a0ad1ee98421bf236977547c90772e7365273f89f68856007a340cc16c53 - Sigstore transparency entry: 2514143385
- Sigstore integration time:
-
Permalink:
chengxilo/serify@ed06f4006f49055a4d91df92fd956040c38262d0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/chengxilo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ed06f4006f49055a4d91df92fd956040c38262d0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file serify-0.1.0-py3-none-any.whl.
File metadata
- Download URL: serify-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a47d988f21da8a1be5bd8729b5ad5de61408a7934853df0fb3af908c2adb9f61
|
|
| MD5 |
378a05bc6c5ddf1afd6c33e6cd121271
|
|
| BLAKE2b-256 |
a5b82291b5c6350a952ce4414fa958248bacfa10c7f933e1c522ae8d71362085
|
Provenance
The following attestation bundles were made for serify-0.1.0-py3-none-any.whl:
Publisher:
release.yml on chengxilo/serify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
serify-0.1.0-py3-none-any.whl -
Subject digest:
a47d988f21da8a1be5bd8729b5ad5de61408a7934853df0fb3af908c2adb9f61 - Sigstore transparency entry: 2514143426
- Sigstore integration time:
-
Permalink:
chengxilo/serify@ed06f4006f49055a4d91df92fd956040c38262d0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/chengxilo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ed06f4006f49055a4d91df92fd956040c38262d0 -
Trigger Event:
push
-
Statement type: