Skip to content

Releases: jcrist/msgspec

Version 0.10.0

08 Dec 04:02
Compare
Choose a tag to compare
  • Add forbid_unknown_fields configuration option to Struct 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

28 Oct 01:49
Compare
Choose a tag to compare
  • Enable Python 3.11 builds (#205)
  • Support greater than microsecond resolution when parsing JSON timestamps (#201)
  • Work around a limitation in mypy for typed decoders (#191)

Version 0.9.0

14 Sep 01:57
Compare
Choose a tag to compare
  • 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

02 Aug 03:42
Compare
Choose a tag to compare
  • 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 of DecodeError) 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

28 Jun 03:54
f08f427
Compare
Choose a tag to compare
  • Further reduce the size of packaged wheels (#130).
  • Add weakref support for Struct types through a new weakref configuration option (#131).
  • Fix a couple unlikely (but possible) bugs in the deallocation routine for Struct types (#131).

Version 0.7.0

20 Jun 18:24
Compare
Choose a tag to compare
  • 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 and eq configuration options for Struct types, mirroring the dataclasses 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 new Struct 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 to gc (a breaking change). To disable GC on a Struct instance you now want to specify gc=False instead of nogc=True (#124).

Version 0.6.0

06 Apr 17:41
Compare
Choose a tag to compare
  • Add a new msgspec.Raw type for delayed decoding of message fields / serializing already encoded fields.
  • Add omit_defaults option to Struct 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 to Struct types (docs) for altering the field names used for encoding. A major use of this is supporting camelCase JSON field names, while letting Python code use the more standard snake_case field names.
  • Improve performance of nogc=True structs. GC is now avoided in more cases, and nogc=True structs use 16 fewer bytes per instance. Also added a benchmark for how msgspec 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

09 Mar 06:40
Compare
Choose a tag to compare
  • Support tagged unions for encoding/decoding a Union of msgspec.Struct types.
  • Further improve encoding performance of enum.Enum by 20-30%
  • Reduce overhead of calling msgspec.json.decode/msgspec.msgpack.decode with type=SomeStructType. It's still faster to create a Decoder once and call decoder.decode multiple times, but for struct types the overhead of calling the top-level function is decreased significantly.
  • Rename the Struct option asarray to array_like (a breaking change)

Version 0.4.2

28 Feb 17:59
Compare
Choose a tag to compare
  • 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

23 Feb 17:39
Compare
Choose a tag to compare
  • Optimize decoding of Enum types, ~10x faster
  • Optimize decoding of IntEnum types, ~12 faster
  • Support decoding typing.Literal types
  • Add nogc option for Struct types, disabling the cyclic garbage collector for their instances