Msgspec

Latest version: v0.19.0

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

Scan your dependencies

Page 4 of 6

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).

0.10.1

- Ignore attributes with leading underscores (`"_"`) when encoding `dataclasses` (234)

0.10.0

- 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](https://jcristharif.com/msgspec/constraints.html#datetime-constraints) 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)

0.9.1

- 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)

0.9.0

- Support for [constraints](https://jcristharif.com/msgspec/constraints.html) during validation. For example, this allows ensuring a field is an integer >= 0. (#176)
- New utilities for generating [JSON Schema](https://jcristharif.com/msgspec/jsonschema.html) from type definitions (#181)
- Support for pretty printing using [rich](https://rich.readthedocs.io/en/stable/pretty.html) (#183)
- Improve integer encoding performance (170)
- Builtin support for renaming fields using kebab-case (175)
- Support for passing a mapping when renaming fields (185)

0.8.0

- Support integer tag values when using [tagged unions](https://jcristharif.com/msgspec/structs.html#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).

Page 4 of 6

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.