Releases: jcrist/msgspec
Version 0.15.1
Version 0.15.0
- Add support for Generic
Structtypes (#386, #393). - Add support for Generic
dataclassesandattrstypes (#396). - Add support for Generic
typing.TypedDictandtyping.NamedTupletypes (#398). - BREAKING: No longer normalize timezones to UTC when decoding
datetimeobjects from JSON (#391). - Support decoding unhyphenated UUIDs (#392).
- A few type annotation fixups (#383, #387).
- Dedent docstrings for descriptions when generating JSON schemas (#397).
- Use a variant of
__qualname__when auto-generating Struct tags rather than__name__(#399). - Fix bug when handling
typing.Literaltypes containing a literalNone(#400). - Make all
Encoder/Decodermethods threadsafe (#402). - BREAKING: Drop the
write_buffer_sizekwarg toEncoder(#402).
Version 0.14.2
- Remove
__del__trashcan usage for structs withgc=False(#369). - Support overriding
__setattr__in Struct types (#376). - Support encoding large integers in JSON (#378).
- Fix a memory leak when msgpack decoding variable length tuples with more than 16 elements (#380).
- Remove JSON compatibility checks when constructing a
msgspec.json.Decoder. Trying to decode messages into types that JSON doesn't support will now error at decode time, rather than when the decoder is constructed (#381).
Version 0.14.1
Version 0.14.0
- Support encoding and decoding attrs types (#323).
- Add
repr_omit_defaultsconfiguration option for omitting struct default values in therepr(#322). - Expose a struct's configuration through a
__struct_config__attribute (#328). - Add
msgspec.structs.fieldsutility function for inspecting the fields configured on a Struct (#330). - Add a
dictconfiguration option for adding a__dict__attribute to a Struct (#331). - Allow non-struct mixins to be used with struct types (#332).
- Fix a bug when defining both
ltandgtconstraints on an integer type (#335). - Fix a bug supporting fields defined with
msgspec.field()with no arguments (#343). - Allow arbitrary input types to
msgspec.from_builtins(#346). - Support decoding into subclasses of
int&bytesinmsgspec.from_builtins(#346). - Add
msgspec.UNSETandmsgspec.UnsetTypefor tracking unset fields. See the docs for more information (#350). - BREAKING: In the unlikely event you were using the previous
msgspec.UNSETsingleton to explicitly indicate no default value on struct types, you should now make use ofmsgspec.NODEFAULTinstead (#350). - Improve struct type annotations now that
mypysupportstyping.dataclass_transform(#352). - Support
typing.Finalannotations for indicating that an object field should be treated as immutable (#354). - Add a
namekeyword option tomsgspec.fieldfor renaming a single field (#356). - BREAKING: The rules around class inheritance and a struct's
renameoption have changed. See #356 for more information.
Version 0.13.1
- Fix a memory leak in the JSON decoder introduced in 0.13.0, caused by a reference counting bug when decoding into
Structtypes (#312).
Version 0.13.0
- Add
to_builtinsfunction for converting messages composed of any supported type to ones composed of only simple builtin types commonly supported by Python serialization libraries (#258). - Add
from_builtinsfunction for converting and validating messages composed of simple builtin types to ones composed of any type msgspec supports (#266, #302). - Add
msgspec.yamlmodule for encoding/decoding YAML (#267). - Add
msgspec.tomlmodule for encoding/decoding TOML (#268). - Add
msgspec.structs.replacefunction for creating a copy of an existingStructwith some changes applied (#262). - Add
msgspec.structs.asdictandmsgspec.structs.astuplefunctions for converting a struct instance to adictortuplerespectively (#300). - Support arbitrarily nested
typing.NewType/typing.Annotatedtypes (#272). - Improve error message for invalid keyword arguments passed to
Struct.__init__(#273). - Support
default_factoryconfiguration forStructfields (#274). - BREAKING: With the exception of empty builtin collections (
[],{},set(),bytearray()), mutable default values in Struct types are no longer deepcopied when used. If a different mutable default value is needed, please configure adefault_factoryinstead (#274). - Improve performance of creating Structs with default parameters (#274).
- Support
typing.ClassVarannotations ofStructtypes (#281). - Support encoding/decoding
decimal.Decimaltypes (#288). - Support "abstract" type annotations like
collections.abc.MutableMapping/typing.MutableMappingin decoders (#290). - Support any string-like or int-like type as a
dictkey when encoding or decoding JSON (#292). - Improved performance encoding large collections in JSON and MessagePack encoders (#294, #298).
Version 0.12.0
-
Support encoding
setandfrozensetsubclasses (#249). -
Support encoding/decoding
typing.NewTypetypes (#251). -
Allow creating a
msgspec.Rawobject from astr(#252). -
Add new experimental
msgspec.inspectmodule for inspecting type annotations. This is intended to be used for building downstream tooling based on msgspec-compatible types. See the docs for more information (#253). -
Add new
extrafield tomsgspec.Meta, for storing arbitrary user-defined metadata (#255). -
Improved performance for JSON encoding strings (#256).
Version 0.11.0
-
Improve performance of constructors for
Structtypes when using keyword arguments (#237). -
Support constraints on dict keys for JSON (#239).
-
Add support for keyword-only arguments in
Structtypes, matching the behavior ofkw_onlyfordataclasses(#242). -
BREAKING: Change the parameter ordering rules used by
Structtypes to match the behavior ofdataclasses. For most users this change shouldn't break anything. However, if your struct definitions have required fields after optional fields, you'll now get an error on import. This error can be fixed by either:- Reordering your fields so all required fields are before all optional fields
- Using keyword-only parameters (by passing the
kw_only=Trueoption).
See Field Ordering for more information (#242).
-
Support encoding/decoding dictionaries with integer keys for JSON (#243).
Version 0.10.1
- Ignore attributes with leading underscores (
"_") when encodingdataclasses(#234)