skillfed

msgspec-m

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML.

msgspec-m v0.19.3 74.8K downloads/30d#14,794 on PyPI7
Permissive license BSD AGING released

What it is and what it does

msgspec-m is a community-maintained fork of msgspec packaged as a PyPI wheel for easier installation. It provides high-performance encoders and decoders for JSON, MessagePack, YAML, and TOML, combined with zero-cost schema validation using standard Python type annotations. The library includes a Struct type for representing structured data with performance characteristics significantly faster than dataclasses or attrs for common operations.

The package is designed to handle the full serialization and validation workflow: you define schemas using type annotations, encode messages to one of the supported protocols, and decode them back with optional schema validation. It has no runtime dependencies and is intended as a drop-in replacement for slower serialization libraries when performance matters. However, the fork explicitly accepts only minimal maintenance and packaging updates, not new features.

Use it for:

  • Replace slower JSON libraries in performance-critical applications that need fast encoding and decoding.
  • Validate incoming API payloads or configuration files against Python type schemas without separate validation overhead.
  • Serialize structured data to MessagePack, YAML, or TOML for interoperability with non-Python systems.
  • Use Struct types as lightweight, fast alternatives to dataclasses when defining message or data transfer objects.

Worth the install?

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

msgspec-m is a fast serialization and validation library supporting JSON, MessagePack, YAML, and TOML with zero-cost schema validation using Python type annotations.

Yes, if you need fast serialization with schema validation and accept the trade-off of a community fork in maintenance mode. The package offers genuine performance gains and is well-suited for latency-sensitive services, data pipelines, and API layers. However, be aware that it receives only minimal maintenance and packaging updates—not new features—so evaluate whether upstream msgspec or the original fork better fits your long-term needs.

Install

msgspec-m on PyPI

pip

pip install msgspec-m

uv

uv add msgspec-m

poetry

poetry add msgspec-m

Installing msgspec-m

Before you install

Medium install friction due to compiled wheels; however, prebuilt binaries are available for common platforms (macOS, Linux, Windows) across Python 3.10–3.14. The package is aging (273 days since last release) and explicitly states it accepts only minimal maintenance and packaging updates, not new features.

License in practice

BSD license (permissive) imposes no significant restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install msgspec-m

import msgspec

class User(msgspec.Struct):
    name: str
    email: str | None = None

alice = User("alice", email="alice@example.com")
msg = msgspec.json.encode(alice)
decoded = msgspec.json.decode(msg, type=User)

Requires Python 3.9 or later; compiled wheels are provided but source builds require a C compiler.

Verify before relying

  • Whether this fork receives timely security patches or bug fixes relative to the upstream jcrist/msgspec repository.
  • Whether the fork's wheel availability on PyPI is stable long-term or subject to maintenance gaps.

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance aging — 273 days since the last release
Last repo commit
First released
Downloads 74,779/month — #14,794 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: msgspec_m-0.19.3-cp310-cp310-macosx_10_9_x86_64.whl; msgspec_m-0.19.3-cp310-cp310-macosx_11_0_arm64.whl; msgspec_m-0.19.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; msgspec_m-0.19.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; msgspec_m-0.19.3-cp310-cp310-musllinux_1_2_aarch64.whl; msgspec_m-0.19.3-cp310-cp310-musllinux_1_2_x86_64.whl; msgspec_m-0.19.3-cp310-cp310-win_amd64.whl; msgspec_m-0.19.3-cp311-cp311-macosx_10_9_x86_64.whl; msgspec_m-0.19.3-cp311-cp311-macosx_11_0_arm64.whl; msgspec_m-0.19.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; msgspec_m-0.19.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; msgspec_m-0.19.3-cp311-cp311-musllinux_1_2_aarch64.whl; msgspec_m-0.19.3-cp311-cp311-musllinux_1_2_x86_64.whl; msgspec_m-0.19.3-cp311-cp311-win_amd64.whl; msgspec_m-0.19.3-cp312-cp312-macosx_10_13_x86_64.whl; msgspec_m-0.19.3-cp312-cp312-macosx_11_0_arm64.whl; msgspec_m-0.19.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; msgspec_m-0.19.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; msgspec_m-0.19.3-cp312-cp312-musllinux_1_2_aarch64.whl; msgspec_m-0.19.3-cp312-cp312-musllinux_1_2_x86_64.whl

Keywords: JSON, msgpack, MessagePack, TOML, YAML, serialization, validation, schema

Development Status :: 4 - BetaLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9

Tags

fast JSON serialization PythonMessagePack encoder decoderschema validation type annotationsYAML TOML serializationhigh-performance serialization library
serializationvalidationperformance

More Software Development packages