msgspec-m 0.19.2


pip install msgspec-m

  Latest version

Released: Oct 15, 2025


Meta
Maintainer: marimo team
Requires Python: >=3.9

Classifiers

License
  • OSI Approved :: BSD License

Development Status
  • 4 - Beta

Programming Language
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

โš ๏ธ Community Fork Notice This repository is a community-maintained fork of jcrist/msgspec. The goal is to publish wheels to PyPI as msgspec-m for easier installation. We are not accepting new features or major changes โ€” only minimal maintenance and packaging updates.


msgspec

msgspec is a fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML. It features:

  • ๐Ÿš€ High performance encoders/decoders for common protocols. The JSON and MessagePack implementations regularly benchmark as the fastest options for Python.

  • ๐ŸŽ‰ Support for a wide variety of Python types. Additional types may be supported through extensions.

  • ๐Ÿ” Zero-cost schema validation using familiar Python type annotations. In benchmarks msgspec decodes and validates JSON faster than orjson can decode it alone.

  • โœจ A speedy Struct type for representing structured data. If you already use dataclasses or attrs, structs should feel familiar. However, they're 5-60x faster for common operations.

All of this is included in a lightweight library with no required dependencies.


msgspec may be used for serialization alone, as a faster JSON or MessagePack library. For the greatest benefit though, we recommend using msgspec to handle the full serialization & validation workflow:

Define your message schemas using standard Python type annotations.

>>> import msgspec

>>> class User(msgspec.Struct):
...     """A new type describing a User"""
...     name: str
...     groups: set[str] = set()
...     email: str | None = None

Encode messages as JSON, or one of the many other supported protocols.

>>> alice = User("alice", groups={"admin", "engineering"})

>>> alice
User(name='alice', groups={"admin", "engineering"}, email=None)

>>> msg = msgspec.json.encode(alice)

>>> msg
b'{"name":"alice","groups":["admin","engineering"],"email":null}'

Decode messages back into Python objects, with optional schema validation.

>>> msgspec.json.decode(msg, type=User)
User(name='alice', groups={"admin", "engineering"}, email=None)

>>> msgspec.json.decode(b'{"name":"bob","groups":[123]}', type=User)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
msgspec.ValidationError: Expected `str`, got `int` - at `$.groups[0]`

msgspec is designed to be as performant as possible, while retaining some of the nicities of validation libraries like pydantic. For supported types, encoding/decoding a message with msgspec can be ~10-80x faster than alternative libraries.

See the documentation for more information.

LICENSE

New BSD. See the License File.

Wheel compatibility matrix

Platform CPython 3.9 CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13 CPython 3.14
macosx_10_13_x86_64
macosx_10_15_x86_64
macosx_10_9_x86_64
macosx_11_0_arm64
manylinux2014_aarch64
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_x86_64
manylinux_2_28_aarch64
manylinux_2_28_x86_64
musllinux_1_2_aarch64
musllinux_1_2_x86_64
win_amd64

Files in release

msgspec_m-0.19.2-cp310-cp310-macosx_10_9_x86_64.whl (207.3KiB)
msgspec_m-0.19.2-cp310-cp310-macosx_11_0_arm64.whl (211.9KiB)
msgspec_m-0.19.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (201.5KiB)
msgspec_m-0.19.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (209.3KiB)
msgspec_m-0.19.2-cp310-cp310-musllinux_1_2_aarch64.whl (203.7KiB)
msgspec_m-0.19.2-cp310-cp310-musllinux_1_2_x86_64.whl (211.8KiB)
msgspec_m-0.19.2-cp310-cp310-win_amd64.whl (181.8KiB)
msgspec_m-0.19.2-cp311-cp311-macosx_10_9_x86_64.whl (203.8KiB)
msgspec_m-0.19.2-cp311-cp311-macosx_11_0_arm64.whl (209.3KiB)
msgspec_m-0.19.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (199.2KiB)
msgspec_m-0.19.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (206.3KiB)
msgspec_m-0.19.2-cp311-cp311-musllinux_1_2_aarch64.whl (201.3KiB)
msgspec_m-0.19.2-cp311-cp311-musllinux_1_2_x86_64.whl (208.4KiB)
msgspec_m-0.19.2-cp311-cp311-win_amd64.whl (182.0KiB)
msgspec_m-0.19.2-cp312-cp312-macosx_10_13_x86_64.whl (213.4KiB)
msgspec_m-0.19.2-cp312-cp312-macosx_11_0_arm64.whl (219.8KiB)
msgspec_m-0.19.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (208.5KiB)
msgspec_m-0.19.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (215.5KiB)
msgspec_m-0.19.2-cp312-cp312-musllinux_1_2_aarch64.whl (211.2KiB)
msgspec_m-0.19.2-cp312-cp312-musllinux_1_2_x86_64.whl (218.9KiB)
msgspec_m-0.19.2-cp312-cp312-win_amd64.whl (183.4KiB)
msgspec_m-0.19.2-cp313-cp313-macosx_10_13_x86_64.whl (213.6KiB)
msgspec_m-0.19.2-cp313-cp313-macosx_11_0_arm64.whl (219.8KiB)
msgspec_m-0.19.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (208.6KiB)
msgspec_m-0.19.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (215.5KiB)
msgspec_m-0.19.2-cp313-cp313-musllinux_1_2_aarch64.whl (211.3KiB)
msgspec_m-0.19.2-cp313-cp313-musllinux_1_2_x86_64.whl (219.1KiB)
msgspec_m-0.19.2-cp313-cp313-win_amd64.whl (183.3KiB)
msgspec_m-0.19.2-cp314-cp314-macosx_10_15_x86_64.whl (213.7KiB)
msgspec_m-0.19.2-cp314-cp314-macosx_11_0_arm64.whl (219.4KiB)
msgspec_m-0.19.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (208.2KiB)
msgspec_m-0.19.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (215.0KiB)
msgspec_m-0.19.2-cp314-cp314-musllinux_1_2_aarch64.whl (210.8KiB)
msgspec_m-0.19.2-cp314-cp314-musllinux_1_2_x86_64.whl (218.2KiB)
msgspec_m-0.19.2-cp314-cp314-win_amd64.whl (187.1KiB)
msgspec_m-0.19.2-cp39-cp39-macosx_10_9_x86_64.whl (207.7KiB)
msgspec_m-0.19.2-cp39-cp39-macosx_11_0_arm64.whl (212.2KiB)
msgspec_m-0.19.2-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (201.5KiB)
msgspec_m-0.19.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (209.4KiB)
msgspec_m-0.19.2-cp39-cp39-musllinux_1_2_aarch64.whl (203.7KiB)
msgspec_m-0.19.2-cp39-cp39-musllinux_1_2_x86_64.whl (212.0KiB)
msgspec_m-0.19.2-cp39-cp39-win_amd64.whl (181.8KiB)
msgspec_m-0.19.2.tar.gz (212.3KiB)