msgspec
msgspec copied to clipboard
A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
### Description I would like a way that does the runtime validation when creating instances manually. Currently I have this as a base class: ```py class Base(Struct, kw_only=True, frozen=True): @classmethod...
### Description I don't know if this is a bug, or just something that can't be supported. I've reviewed some of the other issues surrounding metaclasses and it seems there...
Allowing For DeclarativeBases or other ways of working with msgspec.Structs directly with SQLAlchemy
### Description I asked the [sqlalchemy devs what they thought](https://github.com/sqlalchemy/sqlalchemy/discussions/12278) would be the smartest ideas for merging SQLAlchemy with this library would be and I am waiting to hear back...
Currently instances of UnsetType are falsy as would be expected but the type definition doesn't reflect this. Tiny change so that I and others could stop seeing red squiggly lines
### Description whl or compiled Windows ARM version
Static type checkers currently complain if querying the encoded field names instead of the attribute names.
Also clarify differences between `to_builtins` and `asdict`. Closes #778
### Question I'm trying to equal np.save and np.load times **from file** but I'm pretty far. is there any way to optimize my class? ```python import pathlib import time from...
### Question I want to convert an incoming comma-separated string to a set of enum members. This is my current solution: ```Python # to avoid extra whitespace SPLIT_PATTERN: re.Pattern[str] =...
### Description I want to define JSON fields. I thus use the following code. ``` import msgspec import uuid from typing import TypeAlias t_JSON: TypeAlias = dict[str, "t_JSON"] | list["t_JSON"]...