Skip to main content

e-serde

CI PyPI Python License

Universal structured-data loader: native Rust codecs that decode any popular config format into native Python objects — and, when you ask, into frozen msgspec models. Two verbs, loads/dumps, sync and async twins, one wheel. json-module semantics, strict typing, no surprises.

Part of the Eager (e-) stack by damvolkov, built on open-source engines — the speed and robustness of C and Rust, for serialization in Python.

Install

uv add e-serde          # or: pip install e-serde

Usage

import eserde
from pathlib import Path
import msgspec

eserde.__version__          # '0.1.0'

# bytes/str sources name the format; Paths autodetect by extension.
cfg = eserde.loads(b'{"host": "0.0.0.0", "port": 8080}', format=eserde.Format.JSON)
# {'host': '0.0.0.0', 'port': 8080}

raw = eserde.dumps({"name": "demian", "n": 42}, format=eserde.Format.YAML)
# b'name: demian\n"n": 42\n'

cfg = eserde.load(Path("config.toml"))        # format inferred from the .toml suffix

# validate straight into a frozen model — Rust decodes, msgspec validates
class Server(msgspec.Struct, frozen=True):
    host: str
    port: int

srv = eserde.loads(b'{"host": "x", "port": 8080}', format=eserde.Format.JSON, type=Server)
# Server(host='x', port=8080)

# file helpers, json-module semantics
eserde.dump(cfg, Path("out.jsonc"))

# custom types, per call (json/orjson semantics) — no global patching
from fractions import Fraction
eserde.dumps({"f": Fraction(1, 2)}, format=eserde.Format.JSON, default=float)
# b'{"f":0.5}'
eserde.loads(b'{"n": 5}', format=eserde.Format.JSON, type=SomePydanticModel)
# validated through TypeAdapter; violations still surface as eserde.LoadError

# json-module drop-in for frameworks that duck-type it (aiohttp, structlog, logging)
from eserde import compat
compat.dumps({"a": 1}, ensure_ascii=False)         # '{"a":1}' native compact utf-8

Async — I/O and GIL-free native parsing off the event loop:

async def main():
    srv = await eserde.aloads(Path("config.yaml"), type=Server)

strict=False enables type coercion — the escape hatch INI needs. The full guide lives at damvolkov.github.io/e-serde.

Formats and backends

Format Extension Engine Notes
JSON .json msgspec.json (C) fastest-in-class decode
JSONC .jsonc jsonc-parser (Rust, Deno) comments, trailing commas
YAML .yaml .yml saphyr (Rust) YAML 1.2 core schema
TOML .toml toml (Rust) datetimes → ISO strings
INI .ini .cfg .conf rust-ini (Rust) no interpolation

Everything Rust lives in one extension module (eserde._native), compiled by maturin from crates/native. The only runtime dependency is msgspec.

Benchmarks

Median decode of a 100 KB config on CPython 3.14 (release build). Regenerate with make bench.

loads

Format e-serde fastest rival margin
JSON 0.17 ms orjson 0.16 ms ≈tie (uses msgspec)
YAML 2.24 ms pyyaml (C) 5.3× slower ruamel 66× slower
TOML 1.64 ms rtoml 1.4× slower tomlkit 42× slower
JSONC 0.66 ms pyjson5 faster ×0.6 the one format behind
INI 1.87 ms configparser 10× slower —

Because the Rust codecs release the GIL, aloads parallelizes decode: on 10 MB YAML/TOML the async fan-out is ~2× faster than serial sync (JSON stays flat — msgspec's C decoder holds the GIL). More charts in assets/benchmarks/: dumps · typed · async · memory.

Architecture

crates/native/          single Rust cdylib, one submodule per format
src/eserde/
  __init__.py           the one façade: import eserde; eserde.loads(...)
  infra/                contracts with zero internal deps: errors, formats, io, protocols
  backends/             one folder per engine: native/ (Rust), msgspec/ (C) + registry
  logic/                the facade functions: loads/dumps/load/dump/async + Jsonable encoder
tests/
  unit/eserde/          exact mirror of src
  benchmark/            rival matrix + report renderer
  resources/            canonical sample.* fixtures
docs/                   mkdocs-material site

Only the package root has an __init__.py; every subpackage is a namespace folder. Import boundaries are enforced by tach: eserde → logic → backends → infra/_native.

Design rules:

  • loads/dumps operate on bytes | str | Path; load/dump on Path or binary handles.
  • type= routes the decoded tree through msgspec.convert: validation is msgspec's, decoding is Rust's. strict=False enables coercion.
  • dumps normalizes through the Jsonable encoder first (datetime → ISO, Enum → value, bytes → base64), so every format sees the same tree.
  • Round-trip losses are explicit: JSONC comments are dropped on dumps; TOML has no null; YAML non-scalar keys and multi-document streams are rejected.

Development

uv sync                  # installs the dev group, builds the extension in place
make test                # pytest
make check               # ruff + format + ty + tach + pytest (what CI runs)
make bench               # rival benchmark matrix → assets/benchmarks/*.png

Roadmap

The next iteration probes interop: using e-serde as the front-end decoder for msgspec, pydantic and fastapi request/config pipelines.

License

MIT — see LICENSE.

Release files for e-serde 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for e-serde 0.1.0
File Size Uploaded
e_serde-0.1.0.tar.gz 23.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for e-serde 0.1.0
File
e_serde-0.1.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
e_serde-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details
e_serde-0.1.0-cp314-cp314-manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ ARM64 Details
e_serde-0.1.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
e_serde-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details

Total release size: 2.1 MB

Release files / e_serde-0.1.0.tar.gz

Download URL e_serde-0.1.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6dbff946feffabf8e508c7ba9d8becf73084f3e969190da648617d3b49a184bb
BLAKE2b-256 checksum
How to use checksums
7a92a4eb543413cb84862907776c3a0165d9fef7397ff47cd7378c8e7c8ac971
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / e_serde-0.1.0-cp314-cp314-win_amd64.whl

Download URL e_serde-0.1.0-cp314-cp314-win_amd64.whl
Size 355.1 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
181f6fd319e57b23ab18e43eaa9fd937cdbda9f05a25fc15e44860bffd2e3cfa
BLAKE2b-256 checksum
How to use checksums
fb82904998d764c1b6f3f563d88c49989dd4c21a2c74ca434a7cd98aa4de1d9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / e_serde-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL e_serde-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
Size 451.3 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2314fcf020f765b5d31976b838fcf1b8c6c9b4d68493ba2a4efb24a12f213f4d
BLAKE2b-256 checksum
How to use checksums
448e7abb9cbd813d97d1769fa4d206ed922a4d8b7c1883c10e4996ab2d1e5e41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / e_serde-0.1.0-cp314-cp314-manylinux_2_28_aarch64.whl

Download URL e_serde-0.1.0-cp314-cp314-manylinux_2_28_aarch64.whl
Size 437.1 kB
Tags CPython 3.14 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
2f055f53d7dc984278bd3eefd156ffd77c732386c35c7ec3665b0b6944bc4d68
BLAKE2b-256 checksum
How to use checksums
84ff87054f34e0a49f744df9934b5252eed3a3e4ac98b00bbdd5adc227ba3d8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / e_serde-0.1.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL e_serde-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Size 406.3 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6a5fb301e977397fbd847f404d0a202f9bec1b63057c4c806b188477e4920cef
BLAKE2b-256 checksum
How to use checksums
aa32ff3d533b2ce9acd8ee31f3a970077d150a3767ef9061fb1e7055ac31d579
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / e_serde-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl

Download URL e_serde-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl
Size 428.2 kB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c76efd734c1b977d88ce3c875890b5bae5647c2bbbcc21ee72fd4d681abfa281
BLAKE2b-256 checksum
How to use checksums
77b1d9e0875dcd964bdc2302b3679ed3bc4b716597c1c9f9bbf7f1822d7050a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

6 release files

0.4.0

6 release files

0.3.0

6 release files

0.2.1

6 release files

0.2.0

6 release files

0.1.1

6 release files

This release

0.1.0 This release

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page