msgspec
msgspec copied to clipboard
A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
### Description Please, add donations for your project :)
### Description Sorry if this exists somewhere else. I did not find it. It would be excellent if there was native support for `pathlib.Path`. Especially when reading YAML and TOML...
### Description Validating a field annotated as `Type[X]` (or derivatives e.g. `List[Type[X]]`) ignores `X`; it just validates that the input is a type, not a subclass of `X`. MCVE: ```py...
### Description Hi, is there any ways to default a tag? for example bookTicker: {'u': 26218595314, 's': 'ETHUSDT', 'b': '1670.39000000', 'B': '86.53880000', 'a': '1670.40000000', 'A': '70.13720000'} # which does not...
### Description Hi! Love the library! I switched our entire code base from marshmallow to msgspec and experienced an amazing up to 200 times speed up. I was wondering whether...
### Description for example ```python import msgspec msgspec.convert(b'qq', type=str, strict=False) class S(msgspec.Struct): hash: bytes content: str msgspec.convert({'hash': b'...', 'content': b'...'}, type=S) ```
### Description Continuing from https://github.com/jcrist/msgspec/issues/474#issue-1792097063 OpenAPI continues to have issues with parsing. When attempting to parse fields such as ```python from msgspec import Meta, Struct, field from typing import Annotated,...
### Description Split out from https://github.com/jcrist/msgspec/issues/491#issuecomment-1652031394 From @jcrist: > We currently don't do anything with attrs converters. My reasoning was that IMO converters are for handling flexibility on the python...
### Description I'm looking for stream unpacking, similar to ```python import msgpack from io import BytesIO buf = BytesIO() for i in range(100): buf.write(msgpack.packb(i, use_bin_type=True)) buf.seek(0) unpacker = msgpack.Unpacker(buf, raw=False)...
### Description How do you feel about adding CSV support, similar to what's provided in the `yaml` and `toml` modules? It's easy enough to implement yourself, but I feel like...