Mashumaro

Latest version: v3.15

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

Scan your dependencies

Page 7 of 12

2.6

Changes
--------

* Added support for `TypeVar` types. It works like `Union` under the hood and both constraints and upper bound can be used to specify a variation of types. Similarly to `Union` it's recommended to place more complex variant types at first place like `TypeVar("T", Dict[int, int], List[int])` not `TypeVar("T", List[int], Dict[int, int])`.
* Added support for short version of standard generic types without specifying type of objects kept in containers. Now it's possible to use `List` instead of `List[Any]` or `Dict` instead of `Dict[Any, Any]`.
* Improved string representation of builtin and standard generic types. Now in the error messages you will see `int` instead of `builtins.int` or `List` instead of `typing.List`.

2.5

Changes
--------

* Fixed broken serialization of data classes that also inherit another supported serializable class like `MutableMapping`. See https://github.com/Fatal1ty/mashumaro/issues/48.
* Fixed broken deserialization of `Union` type fields in some cases.

2.4

Changes
--------

* Fixed calling `to_dict` method of a class that doesn't have [`omit_none`](https://github.com/Fatal1ty/mashumaro#add-omit_none-keyword-argument) and [`by_alias`](https://github.com/Fatal1ty/mashumaro#add-by_alias-keyword-argument) keyword arguments added in case it has a field of the type that has these arguments added:
python
dataclass
class A(DataClassDictMixin):
x: Optional[int] = None

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

dataclass
class B(DataClassDictMixin):
a: Optional[A] = None

This caused an exception NameError: name 'omit_none' is not defined
print(B(a=A(1)).to_dict())

2.3

Changes
--------

* Improved deserialization speed by removing import statements from generated code.
* Fixed using annotations with self-references. See https://github.com/Fatal1ty/mashumaro/issues/28.
* Fixed using `SerializableType` data classes.
* Fixed getting `UnserializableField` for data classes without `DataClassDictMixin` parent.
* Added a new exception `ThirdPartyModuleNotFoundError`, that is raised in case you use `pendulum` or `ciso8601` as the deserialization method, but the corresponding package isn't installed.

2.2

Changes
--------

* Added support for [`__slots__`](https://docs.python.org/3/reference/datamodel.html#slots) attribute. See https://github.com/Fatal1ty/mashumaro/issues/47.

2.1

Changes
--------

* Added support for aliases:
* new [`alias`](https://github.com/Fatal1ty/mashumaro#alias-option) field option
* new [`aliases`](https://github.com/Fatal1ty/mashumaro#aliases-config-option) config option
* new [`serialize_by_alias`](https://github.com/Fatal1ty/mashumaro#serialize_by_alias-config-option) config option
* new [`TO_DICT_ADD_BY_ALIAS_FLAG`](https://github.com/Fatal1ty/mashumaro#add-by_alias-keyword-argument) code generation option

Page 7 of 12

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.