msgspec icon indicating copy to clipboard operation
msgspec copied to clipboard

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML

Results 211 msgspec issues
Sort by recently updated
recently updated
newest added
trafficstars

### Question Hello! I have a very specific use case at hand and I would like to ask if there is a better supported way to achieve what I am...

### Question I would like to convert some built-in types to numpy dtype instances in order to save some memory, numpy fields are part of msgspec struct. Is it possible...

### Description When subclassing a msgspec.Struct and redefine a field with a new alias using msgspec.field(name="new_name"), the new alias does not appear to update the __struct_encode_fields__ attribute of the subclass....

It looks like accessing `__annotations__` is likely to change in Python ~3.13~ 3.14. References: - https://peps.python.org/pep-0649/ - https://github.com/beartype/beartype/discussions/335 AFAICT none of this has actually landed in the cpython git repo...

### Description I'm dealing with line-delimited JSON files in which one field can be of multiple types, which all have very different structures. So I naturally defined a base `Struct`...

### Description When decoding plain JSON with duplicate keys, all but the last are silently ignored, for example: ```py >>> msgspec.json.decode(b'{"abc":1,"abc":2}') {'abc': 2} ``` This behaviour is "correct" (it's noted...

### Description The following code: ```python import msgspec as ms class Sub(ms.Struct, omit_defaults=True): f1: str = "" f2: int = 0 class Struct(ms.Struct, omit_defaults=True, tag=True): f1: int = 1 sub:...

### Description Currently, to enable support for a custom type in msgspec, you write hook functions that look like this: ```python def enc_hook(obj: Any) -> Any: ... def dec_hook(type: Type,...

### Question Pydantic can be used for "settings management" (see https://docs.pydantic.dev/latest/concepts/pydantic_settings/) which means parsing/validating from environment variables and .env files. Are you planning to support such a feature, possibly as...

### Description Using `msgspec.json.Decoder.decode()` with a keyword arguments results in an error. Im guessing this has to do with the C-implementation. However, the error is only caught in runtime. Take...