Releases: jcrist/msgspec
Releases · jcrist/msgspec
Version 0.10.0
- Add
forbid_unknown_fields
configuration option toStruct
types (#210) - BREAKING: Encode all
enum
types by value, rather than name (#211) - Fix a bug in the JSON encoder when base64 encoding binary objects (#217)
- Add support for encoding/decoding
dataclasses
(#218) - Add support for encoding/decoding
datetime.date
objects (#221) - Add support for encoding/decoding
uuid.UUID
objects (#222) - BREAKING: support encoding/decoding
datetime.datetime
values without timezones by default (#224). - Add a
tz
constraint to require aware or naive datetime/time objects when decoding (#224). - Add support for encoding/decoding
datetime.time
objects (#225) - Add a
msgspec.json.format
utility for efficiently pretty-printing already encoded JSON documents (#226). - Support decoding JSON from strings instead of just bytes-like objects (#229)
Version 0.9.1
Version 0.9.0
- Support for constraints during validation. For example, this allows ensuring a field is an integer >= 0. (#176)
- New utilities for generating JSON Schema from type definitions (#181)
- Support for pretty printing using rich (#183)
- Improve integer encoding performance (#170)
- Builtin support for renaming fields using kebab-case (#175)
- Support for passing a mapping when renaming fields (#185)
Version 0.8.0
- Support integer tag values when using tagged unions (#135).
- Support decoding into
typing.TypedDict
types (#142). - Support encoding/decoding
typing.NamedTuple
types (#161). - Test against CPython 3.11 prelease builds (#146).
- Add
ValidationError
(a subclass ofDecodeError
) to allow differentiating between errors due to a message not matching the schema from those due to the message being invalid JSON (#155). - Support encoding subclasses of
list
/dict
(#160). - Fix a bug preventing decoding custom types wrapped in a
typing.Optional
(#162).
Version 0.7.1
Version 0.7.0
- Dramatically speedup JSON string decoding, up to 2x speedup in some cases (#118).
- Adds a cache for decoding short (< 32 character) ASCII dict keys. This results in up to a 40% speedup when decoding many dicts with common keys using an untyped decoder. It's still recommended to define
Struct
types when your messages have a common structure, but in cases where no type is provided decoding is now much more performant (#120, #121). - Adds
order
andeq
configuration options forStruct
types, mirroring thedataclasses
options of the same name. Order comparisons for Struct types are very performant, roughly 10x to 70x faster than alternative libraries (#122). - Speedup
Struct
decoding for both JSON and MessagePack, on average 20% faster (#119). - Various additional performance improvements, mostly to the JSON implementation (#100, #101, #102).
- Add
defstruct
method for dynamically defining newStruct
types at runtime (#105). - Fix ARM support and publish ARM wheels for Linux and Mac (#104).
- Reduce published wheel sizes by stripping debug symbols (#113).
- Fix a memory leak in
Struct.__reduce__
(#117). - Rename
nogc
struct option togc
(a breaking change). To disable GC on a Struct instance you now want to specifygc=False
instead ofnogc=True
(#124).
Version 0.6.0
- Add a new
msgspec.Raw
type for delayed decoding of message fields / serializing already encoded fields. - Add
omit_defaults
option toStruct
types (docs). If enabled, fields containing their respective default value will be omitted from serialized message. This improves both encode and decode performance. - Add
rename
option toStruct
types (docs) for altering the field names used for encoding. A major use of this is supportingcamelCase
JSON field names, while letting Python code use the more standardsnake_case
field names. - Improve performance of
nogc=True
structs. GC is now avoided in more cases, andnogc=True
structs use 16 fewer bytes per instance. Also added a benchmark for howmsgspec
can interact with application GC usage. - Cache creation of tagged union lookup tables, reducing memory usage for applications making heavy use of tagged unions.
- Support encoding and decoding
frozenset
instances - A smattering of other performance improvements.
Version 0.5.0
- Support tagged unions for encoding/decoding a
Union
ofmsgspec.Struct
types. - Further improve encoding performance of
enum.Enum
by 20-30% - Reduce overhead of calling
msgspec.json.decode
/msgspec.msgpack.decode
withtype=SomeStructType
. It's still faster to create aDecoder
once and calldecoder.decode
multiple times, but for struct types the overhead of calling the top-level function is decreased significantly. - Rename the Struct option
asarray
toarray_like
(a breaking change)
Version 0.4.2
- Support
Literal
string types as dict keys in JSON - Support Python 3.10 style unions (e.g.
int | float | None
) - Publish Python 3.10 wheels
Version 0.4.1
- Optimize decoding of
Enum
types, ~10x faster - Optimize decoding of
IntEnum
types, ~12 faster - Support decoding
typing.Literal
types - Add
nogc
option forStruct
types, disabling the cyclic garbage collector for their instances