msgspec

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

BSD-3-CLAUSE License

Downloads
3.2M
Stars
1.9K
Committers
22

Bot releases are hidden (Show)

msgspec - Version 0.9.1

Published by jcrist almost 2 years ago

  • 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)
msgspec - Version 0.9.0

Published by jcrist about 2 years ago

  • 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)
msgspec - Version 0.8.0

Published by jcrist about 2 years ago

  • 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).
msgspec - Version 0.7.1

Published by jcrist over 2 years ago

  • 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).
msgspec - Version 0.7.0

Published by jcrist over 2 years ago

  • 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).
msgspec - Version 0.6.0

Published by jcrist over 2 years ago

  • 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.
msgspec - Version 0.5.0

Published by jcrist over 2 years ago

  • 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)
msgspec - Version 0.4.2

Published by jcrist over 2 years ago

  • 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
msgspec - Version 0.4.1

Published by jcrist over 2 years ago

  • 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
msgspec - Version 0.4.0

Published by jcrist over 2 years ago

This is a major release with several large changes:

  • Moved MessagePack support to the msgspec.msgpack submodule
  • New JSON support available in msgspec.json
  • Improved error message generation to provide full path to the mistyped values
  • Renamed the immutable kwarg in msgspec.Struct to frozen to better match python conventions
  • Renamed EncodingError to EncodeError/DecodingError to DecodeError to better match python conventions
  • Improved pyright support, allowing more errors to be statically caught by their type checker
  • Adds support for Python 3.10 pattern matching on msgspec.Struct types
  • Adds support for decoding into typing.Union types (with a few restrictions)
  • General performance improvements across all encoders/decoders
msgspec - Version 0.3.2

Published by jcrist about 3 years ago

  • Faster float encoding and decoding
  • General micro-optimizations for write/read hot path. Most visible for large messages.
msgspec - Version 0.3.1

Published by jcrist over 3 years ago

  • Use a freelist for small structs to improve struct allocation time.
  • Small perf improvement for struct serialization
msgspec - Version 0.3.0

Published by jcrist over 3 years ago

  • Add Encoder.encode_into api, for encoding into an existing buffer without copying
  • Add support for encoding/decoding MessagePack extensions
  • Add support for encoding/decoding datetime objects
  • Add support for encoding/decoding custom objects without relying on MessagePack extensions
  • Add support for marking Struct types as hashable
  • Add support for serializing Struct types as MessagePack array objects rather than map objects.
  • Several performance improvements. On average 50% faster encoding and 30% faster decoding.
msgspec - Version 0.2.0

Published by jcrist over 3 years ago

msgspec - Version 0.1.0

Published by jcrist over 3 years ago