skillfed

serpyco-rs

serpyco-rs v1.22.0 448.3K downloads/30d#6,602 on PyPI41
Permissive license Active released

What it is and what it does

serpyco-rs is a serialization library for Python dataclasses that converts objects to and from built-in Python types (dict, list, etc.) or directly to/from bytes via JSON or MessagePack codecs. It analyzes dataclass field types at serializer creation time and supports a broad range of standard types—lists, tuples, optionals, enums, UUIDs, dates, decimals, unions, and nested dataclasses—along with validation of input data during deserialization.

The library is implemented in Rust for speed and offers both a simple dict-based API (dump/load) and a codec-based API for direct bytes handling. It includes features like field aliasing, custom encoders/decoders, JSON Schema generation, and query-string deserialization with type coercion. The main use case is serializing objects for APIs, though it works for any object-to-type transformation task.

Use it for:

  • Serialize dataclass instances to JSON for REST API responses without intermediate dict conversion.
  • Deserialize and validate incoming JSON payloads against a dataclass schema in a web framework.
  • Convert Python objects to MessagePack for efficient binary storage or network transmission.
  • Generate JSON Schema specifications from dataclass definitions for API documentation.
  • Deserialize query string parameters into typed dataclass instances with automatic coercion.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Serializes and deserializes Python dataclasses to/from dictionaries, JSON, or MessagePack, with built-in validation and support for nested types.

Yes. serpyco-rs is actively maintained, has no known vulnerabilities, and offers strong performance for dataclass serialization. The MIT license is permissive. Install friction is moderate due to compiled wheels, but pre-built binaries are available for common platforms and Python versions 3.10–3.14. Choose it if you need fast, schema-validated serialization of dataclasses for APIs or data transformation.

Install

serpyco-rs on PyPI

pip

pip install serpyco-rs

uv

uv add serpyco-rs

poetry

poetry add serpyco-rs

Installing serpyco-rs

Before you install

Medium install friction due to compiled wheels for multiple platforms and Python versions (3.10–3.14). Active maintenance with a recent release and no known vulnerabilities. Lightweight runtime dependencies (attributes-doc, typing-extensions) keep the footprint small.

License in practice

MIT license (permissive); you can use this freely in commercial and private projects with minimal restrictions.

Quickstart

import dataclasses
import serpyco_rs

@dataclasses.dataclass
class Example:
    name: str
    num: int

serializer = serpyco_rs.Serializer(Example)
result = serializer.dump(Example(name="foo", num=2))
print(result)  # {'name': 'foo', 'num': 2}

Requires Python 3.10 or later.

Verify before relying

  • Whether custom encoder/decoder support covers all common field types needed for your schema.
  • Performance characteristics on deeply nested or very large dataclass hierarchies.
  • Compatibility with third-party dataclass libraries beyond standard library dataclasses.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 2 — attributes-doc, typing-extensions
Maintenance actively maintained — 0 days since the last release
Last repo commit
First released
Downloads 448,312/month — #6,602 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: serpyco_rs-1.22.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl; serpyco_rs-1.22.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; serpyco_rs-1.22.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; serpyco_rs-1.22.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; serpyco_rs-1.22.0-cp310-cp310-manylinux_2_17_ppc64.manylinux2014_ppc64.whl; serpyco_rs-1.22.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; serpyco_rs-1.22.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; serpyco_rs-1.22.0-cp310-cp310-win_amd64.whl; serpyco_rs-1.22.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl; serpyco_rs-1.22.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; serpyco_rs-1.22.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; serpyco_rs-1.22.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; serpyco_rs-1.22.0-cp311-cp311-manylinux_2_17_ppc64.manylinux2014_ppc64.whl; serpyco_rs-1.22.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl; serpyco_rs-1.22.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; serpyco_rs-1.22.0-cp311-cp311-win_amd64.whl; serpyco_rs-1.22.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl; serpyco_rs-1.22.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; serpyco_rs-1.22.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; serpyco_rs-1.22.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

License :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Rust

Tags

dataclass serializationpython object to dictjson serializer dataclassmsgpack encoder pythonschema validation serializerfast dataclass serializationtyped data serialization
serializationdataclassrust-backed

More Software Development packages