Skip to content

Releases: jcrist/msgspec

Version 0.19.0

27 Dec 17:07
Compare
Choose a tag to compare
  • Improve JSON encoding performance by up to 40% (#647).
  • Ensure tuple and frozenset default values are treated identically whether specified by value or default_factory (#653).
  • Fix memory leak of match_args in StructConfig object (#684).
  • Fix memory leak in Raw.copy() (#709).
  • Update decode signatures for PEP 688 (#740).
  • Generate __replace__ method on Struct types, for use with copy.replace (#747).
  • Fix incorrect decoding of certain > 64 bit integers (#751).
  • Call __post_init__ when converting from an object to a Struct (#752).
  • BREAKING: Expand buffer when encode_into is passed a buffer smaller than offset (#753).
  • Support Raw objects as inputs to convert (#754).
  • Error nicely when a dataclass type (instead of an instance) is passed to encode (#755).
  • Drop support for Python 3.8 (#756, #763).
  • Add support for Python 3.13 (#711).
  • Remove deprecated from_builtins (#761).
  • Support encoding any Enum type whose .value is a supported type (#757).
  • Don't fail eagerly when processing generic types with unsupported __parameters__ (#772).
  • Use eval_type_backport to backport type annotations to Python 3.9 (#773).

Version 0.18.6

22 Jan 04:00
0.18.6
Compare
Choose a tag to compare
  • Support coercing integral floats to ints when strict=False (#619).
  • Preserve leading _ when renaming fields to camel or pascal case (#620).
  • Support zero-copy decoding binary fields to a memoryview (#624).
  • Fix a bug when inheriting from the same Generic base class multiple times (#626).
  • Add an order option to all encoders for enforcing deterministic/sorted ordering when encoding. This can help provide a more consistent or human readable output (#627).
  • Support inheriting from any slots-class when defining a new Struct type with gc=False (#635).
  • Automatically infer the input field naming convention when converting non-dict mappings or arbitrary objects to Struct types in msgspec.convert (#636).

Version 0.18.5

13 Dec 04:03
Compare
Choose a tag to compare
  • Support unhashable Annotated metadata in msgspec.inspect.type_info (#566).
  • Fix bug preventing decoding dataclasses/attrs types with default values and slots=True, frozen=True (#569).
  • Support passing parametrized generic struct types to msgspec.structs.fields (#571).
  • Validate str constraints on dict keys when decoding msgpack (#577).
  • Support UUID subclasses as inputs to msgspec.convert (#592).
  • Call __eq__ from generated __ne__ if user defines manual __eq__ method on a Struct type (#593).
  • Include the Struct type in the generated hash (#595).
  • Add a cache_hash struct option (#596).
  • Fix a bug around caching of dataclass type info when dealing with subclasses of dataclasses (#599).
  • Add msgspec.structs.force_setattr (#600).
  • Support custom dict key types in JSON encoder and decoder (#602).
  • Include dict key constraints in generated JSON schema via the propertyNames field (#604).
  • Add a schema_hook for generating JSON schemas for custom types (#605).
  • Add support for Python 3.12's type aliases (#606).

Version 0.18.4

05 Oct 04:29
Compare
Choose a tag to compare
  • Resolve an issue leading to periodic segfaults when importing msgspec on CPython 3.12 (#561)

Version 0.18.3

03 Oct 07:10
Compare
Choose a tag to compare
  • Improve type annotation for Struct.__rich_repr__ (#557)
  • Add pre-built wheels for Python 3.12 (#558)

Version 0.18.2

26 Aug 21:00
Compare
Choose a tag to compare
  • Support Enum._missing_ hooks for handling unknown enum values (#532).
  • Fix JSON encoding of datetime.datetime objects with zoneinfo.ZoneInfo timezone components (#534).
  • Add support for attrs validators (#538).
  • Relax datetime/time parsing format to allow some RFC3339 extensions from ISO8601 (#539).

Version 0.18.1

16 Aug 05:19
Compare
Choose a tag to compare
  • Support custom builtin_types in msgspec.to_builtins (#517).
  • Try getattr before getitem when converting with from_attributes=True (#519).
  • More efficient module state access in top-level functions (#521).

Version 0.18.0

10 Aug 20:45
Compare
Choose a tag to compare
  • Add a new msgspec.json.Decoder.decode_lines method for decoding newline-delimited JSON into a list of values (#485).
  • Support for decoding UUIDs from binary values (#499).
  • Support for encoding UUIDs in alternate formats (#499).
  • Overhaul how dataclasses are encoded to support more dataclass-like objects (#501).
  • Encode all declared fields on a dataclass (#501).
  • Support encoding edgedb.Object instances as dataclass-like objects (#501).
  • Improve performance when json decoding float values (#510).
  • Support for JSON encoding dicts with float keys (#510).
  • Support for JSON decoding dicts with float keys (#510).
  • Add float_hook to msgspec.json.Decoder to support changing the default for how JSON floats are decoded (#511).

Version 0.17.0

12 Jul 00:34
Compare
Choose a tag to compare
  • Ensure None may be explicitly passed to defstruct for module/namespace/bases (#445).
  • Support decoding datetime.datetime values from int/float values (interpreted as seconds since the Unix epoch) when strict=False (#452).
  • Support subclasses of collection types (list, dict, ...) as inputs to convert (#453).
  • Support str subclasses as keys in to_builtins and all protocol encode methods (#454).
  • Improved performance when JSON encoding decimal.Decimal values (#455).
  • Improved performance when JSON encoding int/float values (#458).
  • Improved performance when JSON encoding str values (#459).
  • Wrap errors in dec_hook with a ValidationError (#460).
  • Support decoding decimal.Decimal values from numeric values (#463)
  • Support encoding decimal.Decimal values as numeric values (#465).
  • Support converting decimal.Decimal values to float in convert (#466).
  • Preliminary support for CPython 3.12 beta releases (#467).
  • Support decoding integers that don't fit into an int64/uint64 (#469).
  • Add a new optional __post_init__ method for Struct types (#470).
  • Support decoding 0/1 into bool types when strict=False (#471).
  • Wrap errors raised in __post_init__/__attrs_post_init__ in a ValidationError when decoding (#472).
  • Add native support for encoding/decoding datetime.timedelta types (#475).
  • Add a new msgspec.json.Encoder.encode_lines method for encoding an iterable of values as newline-delimited JSON (#479).

Version 0.16.0

12 Jun 14:58
Compare
Choose a tag to compare
  • Deprecate msgspec.from_builtins in favor of msgspec.convert. The new convert function provides a superset of the functionality available in the old from_builtins function. See the converters docs for more information (#431).
  • Add a from_attributes argument to msgspec.convert for allowing conversion between object types with matching attribute names. One use case for this is converting ORM objects to Struct or dataclasses types (#419).
  • Support passing generic Mapping objects as inputs to msgspec.convert. These may be coerced to dict/Struct/dataclasses/attrs types (#427).
  • Add a new strict keyword argument to all decode functions, Decoder classes, as well as msgspec.convert. This defaults to True, setting it to false enables a wider set of coercion rules (e.g. coercing a str input to an int). See "Strict" vs "Lax" Mode for more information (#434).
  • Allow any of msgspec's supported types as inputs to msgspec.convert (#431, #418).
  • Passthrough input unchanged when coercing to typing.Any type in msgspec.convert (#435).
  • Support parametrizing Decoder types at runtime (#415).
  • Support encoding subclasses of UUID (#429).