Skip to main content

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

serify-0.1.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

serify-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

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

Hashes for serify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1589a0ad1ee98421bf236977547c90772e7365273f89f68856007a340cc16c53
MD5 27b90c5ebe47891ec9ed223a8bcfdaa5
BLAKE2b-256 32b3c03adf1865dca3701245d1939d73156f901847023c14fe4ce673999127e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for serify-0.1.0.tar.gz:

Publisher: release.yml on chengxilo/serify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for serify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a47d988f21da8a1be5bd8729b5ad5de61408a7934853df0fb3af908c2adb9f61
MD5 378a05bc6c5ddf1afd6c33e6cd121271
BLAKE2b-256 a5b82291b5c6350a952ce4414fa958248bacfa10c7f933e1c522ae8d71362085

See more details on using hashes here.

Provenance

The following attestation bundles were made for serify-0.1.0-py3-none-any.whl:

Publisher: release.yml on chengxilo/serify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page