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.
NOTE: If this package has multiple flavors (see below), then use one of them instead of the name specified above. NOTE: This is a Python port. Instead of py311-msgspec listed in the above command, you can pick from the names under the Packages section.
===> The following configuration options are available for py311-msgspec-0.21.1:
TOML=on: TOML format or parser support
YAML=on: YAML format or parser support
===> Use 'make config' to modify these settings
*: Revise USES=python:... version range constraints
and strip all lower bounds of 3.9 or 3.10 because they are implied now.
python:3.9-X -> python:-X
python:3.9+ -> python
python:3.10-X -> python:-X
python:3.10+ -> python
(options such as ,build preserved)
Mk/Uses/python.mk: Introduce PY_TOMLI
- Convert ports to use PY_TOMLI to simplify Makefile.
The minimal version is set to 2.0.1 because it is required by multiple ports
such as devel/py-poetry.
The upper bound of version is set to 3 because it is limited by devel/py-poetry.
With hat: python
devel/py-msgspec: Add py-msgspec 0.18.6
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.