Mashumaro

Latest version: v3.15

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

Scan your dependencies

Page 5 of 12

3.0

Changes
--------
* Added support for new types:
* `typing.NewType`
* `typing.Literal`
* `typing_extensions.Literal`
* `typing.Annotated`
* `typing_extensions.Annotated`
* `zoneinfo.ZoneInfo`
* `typing_extensions.OrderedDict` on Python<3.7.2.
* Fixed using field options when using dataclass slots=True on Python 3.10 (https://github.com/Fatal1ty/mashumaro/issues/68).
* Fixed using postponed evaluation with parent class (https://github.com/Fatal1ty/mashumaro/issues/70).
* Fixed not removing field metadata options for the overridden field without them.
* Fixed serialization of `SerializableType` generic classes.
* Added new [`pass_through`](https://github.com/Fatal1ty/mashumaro/tree/master#passing-field-values-as-is) object that can be used in serialization_strategy and serialize / deserialize options.
* Reduced code building time.
* Use encoder and decoder written in C for YAML by default if available.

Backward incompatible changes
--------
* Moved `msgpack`, `pyyaml` dependencies to `extras_require` (https://github.com/Fatal1ty/mashumaro/issues/7).
* Moved `DataClassJSONMixin`, `DataClassMessagePackMixin`, `DataClassYAMLMixin` to `mashumaro.mixins.*` subpackages.
* Removed `use_bytes`, `use_enum`, `use_datetime` parameters from `DataClassDictMixin` methods.
* Removed encoder and decoder kwargs from `to_*`, `from_*` methods of the serialization mixins in order to pass keyword arguments to underlying `to_dict`, `from_dict` methods.

You can find migration guide here: https://github.com/Fatal1ty/mashumaro/blob/master/docs/2to3.md.

2.11

Changes
--------
* PEP 604 compliance.
* Fixed that `Union[None, X]` with `None` on the first place wasn't treated as `Optional[X]`.
* Fixed that `Union[X, T]` where `T` was resolved to `None` wasn't treated as `Optional[X]`.
* Allow using `None` as the field type (it's [considered](https://www.python.org/dev/peps/pep-0484/#using-none) equivalent to `NoneType`).
* Changed the name of `NoneType` to `None` in Unions for convenience. In the previous versions you could see `Union[int, str, NoneType]` instead of `Union[int, str, None]` if the field was declared as `Union[int, str, None]`.

2.10.1

Changes
--------
* Fixed using nested classes with future annotations import. See https://github.com/Fatal1ty/mashumaro/issues/62.

2.10

Changes
--------
* Added support for [dialects](https://github.com/Fatal1ty/mashumaro#dialects).
* Fixed type hints for `to_msgpack` and `from_msgpack` methods. See https://github.com/Fatal1ty/mashumaro/issues/63.
* Fixed serialzation / deserialization override using `serialization_strategy` config option in a generic dataclass.

2.9.1

Changes
--------

* Fixed installing with third-party tool pdistx. See https://github.com/Fatal1ty/mashumaro/issues/60.
* Fixed serialzation / deserialization override for `Union` and `TypeVar` types. See https://github.com/Fatal1ty/mashumaro/issues/61.
* Fixed the default value of `by_alias` argument of `to_dict` method when using `serialize_by_alias` config option. In the previous versions `by_alias` argument had a default value`False` regardless of whether `serialize_by_alias` config options was used. Now it could be `True`:
python
dataclass
class MyClass(DataClassDictMixin):
x: int

class Config(BaseConfig):
aliases = {"x": "x_alias"}
serialize_by_alias = True
code_generation_options = [TO_DICT_ADD_BY_ALIAS_FLAG]

print(MyClass(x=1).to_dict()) {'x_alias': 1}
print(MyClass(x=1).to_dict(by_alias=False)) {x': 1}

2.9

* Added support for PEP 563 postponed evaluation of annotations. See [here](https://github.com/Fatal1ty/mashumaro/#allow_postponed_evaluation-config-option) for details.
* Added ability to treat named tuples as dictionaries during serialization/deserialization:
* new `as_dict` and `as_list` [serialization](https://github.com/Fatal1ty/mashumaro#serialize-option) and [deserialization](https://github.com/Fatal1ty/mashumaro#deserialize-option) engines
* new [`namedtuple_as_dict`](https://github.com/Fatal1ty/mashumaro#namedtuple_as_dict-config-option) config option

Page 5 of 12

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.