Msgspec

Latest version: v0.18.6

Safety actively analyzes 681866 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 6

0.14.1

- Further optimize decoding of JSON arrays into lists 363
- Fix a bug preventing using structs configured with ``dict=True`` on Python 3.11 365
- Avoid preallocating large lists/tuples in the msgpack decoder 367

0.14.0

- Support encoding and decoding [attrs](https://attrs.org) types (#323).
- Add ``repr_omit_defaults`` configuration option for omitting struct default values in the ``repr`` (322).
- Expose a struct's configuration through a ``__struct_config__`` attribute (328).
- Add `msgspec.structs.fields` utility function for inspecting the fields configured on a Struct (330).
- Add a ``dict`` configuration 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 ``lt`` and ``gt`` constraints 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`` & ``bytes`` in `msgspec.from_builtins` (346).
- Add `msgspec.UNSET` and `msgspec.UnsetType` for tracking unset fields. See the [docs](https://jcristharif.com/msgspec/supported-types.html#unset) for more information (350).
- **BREAKING**: In the unlikely event you were using the previous ``msgspec.UNSET`` singleton to explicitly indicate no default value on struct types, you should now make use of `msgspec.NODEFAULT` instead (350).
- Improve struct type annotations now that ``mypy`` supports `typing.dataclass_transform` (352).
- Support `typing.Final` annotations for indicating that an object field should be treated as immutable (354).
- Add a ``name`` keyword option to `msgspec.field` for renaming a single field (356).
- **BREAKING**: The rules around class inheritance and a struct's ``rename`` option have changed. See 356 for more information.

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 ``Struct`` types (312).

0.13.0

- Add `to_builtins` function 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_builtins` function for converting and validating messages composed of simple builtin types to ones composed of any type msgspec supports (266, 302).
- Add `msgspec.yaml` module for encoding/decoding YAML (267).
- Add `msgspec.toml` module for encoding/decoding TOML (268).
- Add `msgspec.structs.replace` function for creating a copy of an existing `Struct` with some changes applied (262).
- Add `msgspec.structs.asdict` and `msgspec.structs.astuple` functions for converting a struct instance to a `dict` or `tuple` respectively (300).
- Support arbitrarily nested `typing.NewType`/`typing.Annotated` types (272).
- Improve error message for invalid keyword arguments passed to `Struct.__init__` (273).
- Support `default_factory` configuration for `Struct` fields (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 a `default_factory` instead (274).
- Improve performance of creating Structs with default parameters (274).
- Support `typing.ClassVar` annotations of `Struct` types (281).
- Support encoding/decoding `decimal.Decimal` types (288).
- Support "abstract" type annotations like `collections.abc.MutableMapping`/`typing.MutableMapping` in decoders (290).
- Support any string-like or int-like type as a `dict` key when encoding or decoding JSON (292).
- Improved performance encoding large collections in JSON and MessagePack encoders (294, 298).

0.12.0

- Support encoding `set` and `frozenset` subclasses (249).

- Support encoding/decoding `typing.NewType` types (251).

- Allow creating a `msgspec.Raw` object from a `str` (252).

- Add new experimental `msgspec.inspect` module for inspecting type annotations. This is intended to be used for building downstream tooling based on msgspec-compatible types. See [the docs](https://jcristharif.com/msgspec/inspect.html) for more information (#253).

- Add new `extra` field to `msgspec.Meta`, for storing arbitrary user-defined metadata (255).

- Improved performance for JSON encoding strings (256).

0.11.0

- Improve performance of constructors for `Struct` types when using keyword arguments (237).

- Support [constraints](https://jcristharif.com/msgspec/constraints.html) on dict keys for JSON (#239).

- Add support for keyword-only arguments in `Struct` types, matching the behavior of `kw_only` for `dataclasses` (242).

- **BREAKING**: Change the parameter ordering rules used by `Struct` types to match the behavior of `dataclasses`. 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=True`` option).

See [Field Ordering](https://jcristharif.com/msgspec/structs.html#field-ordering) for more information (242).

- Support encoding/decoding dictionaries with integer keys for JSON (243).

Page 3 of 6

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.