msgspec-m
A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML.
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-muv
uv add msgspec-mpoetry
poetry add msgspec-mInstalling 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
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
msgspecmsgspec encodes and decodes JSON, MessagePack,…
permissive · top 1,000 on PyPI
ormsgpackormsgpack is a fast MessagePack serialization…
permissive · top 1,000 on PyPI
u-msgpack-pythonu-msgpack-python serializes and deserializes…
permissive · top 5,000 on PyPI
msgpack-pythonMessagePack serialization and deserialization…
permissive · top 5,000 on PyPI
srslysrsly provides a unified API for serializing…
permissive · top 1,000 on PyPI
msgpackmsgpack serializes and deserializes Python…
permissive · top 1,000 on PyPI
msgspec-clickGenerates Click command-line options…
unclear · top 15,000 on PyPI
quart-schemaQuart-Schema adds schema validation and…
permissive · top 15,000 on PyPI
pyserdeSerialize and deserialize Python dataclasses to…
permissive · top 5,000 on PyPI
python-rapidjsonFast JSON serialization and deserialization…
permissive · top 5,000 on PyPI