msgspec
msgspec copied to clipboard
A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
### Description Currently the `ge`, `gt`, `le`, `lt` constraints are limited to `int`s and `float`s, but `date`s, `datetime`s and `time`s are _comparable_ as well: ```python now = datetime.now(timezone.utc) yesterday =...
### Description Hello, I have a situation where I am getting updates from the server in msgpack format, one of the fields is value that can be Union of str,...
### Description _Separating this from #424 as it's rather a separate discussion / issue:_ After reading through all previously documented issues, that would require some extended and improved hook mechanism...
### Description Hello! I think this is a cool library, and I think you should consider integrating with the attrs ecosystem. A small disclaimer first: I'm a major contributor to...
URL querystrings/`x-www-form-urlencoded` forms are structured but untyped messages. The python standard library has a few tools for encoding/decoding these: ```python In [2]: urllib.parse.parse_qs("x=1&y=true&z=a&z=b") Out[2]: {'x': ['1'], 'y': ['true'], 'z': ['a',...
`msgspec` is a performance oriented library - would be useful to set up continuous benchmarking as part of our CI to catch any performance regressions. These might make use of...
### Description Hey! Was trying out the project in an attempt to experiment with it and hopefully be able to utilize it in one of my projects, as it looks...
# Case 1 ```json [ { "height": 10, "width": 10 }, //
### Question Hello! How to use struct field name instead of field object name? case: ```python import msgspec class MyStruct(msgspec.Struct): my_f: str = msgspec.field(default="", name="struct_f") encoded = msgspec.yaml.encode(msgspec.convert({"struct_f": "Hello"}, type=MyStruct))...
### Question I'm using msgspec to decode some JSON like ```jsonl {"type":"a.xxx","id":"a1"} {"type":"a.yyy","id":"a2"} {"type":"a.zzz","id":"a3"} {"type":"b.xxx","name":"b1"} {"type":"b.yyy","name":"b2"} {"type":"b.zzz","name":"b3"} ``` and now, I am using the following code to process this data....