Releases: Fatal1ty/mashumaro
Releases · Fatal1ty/mashumaro
v2.8
- Added support for Python 3.10
- PEP 585 compliance
- Added support for
TypedDict
- Added support for typed
NamedTuple
and untypednamedtuple
- Fixed
Tuple
serialization and deserialization. Before 2.8 all values of tuples were deserialized as if they were values of the first type, no matter how many values the tuple was supposed to take. Now the following types are handled correctly:Tuple[int]
,Tuple[int, ...]
,Tuple[int, str]
,Tuple[()]
,Tuple
.
v2.7
v2.6.4
v2.6.3
v2.6.2
2.6.1
v2.6
Changes
- Added support for
TypeVar
types. It works likeUnion
under the hood and both constraints and upper bound can be used to specify a variation of types. Similarly toUnion
it's recommended to place more complex variant types at first place likeTypeVar("T", Dict[int, int], List[int])
notTypeVar("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 ofList[Any]
orDict
instead ofDict[Any, Any]
. - Improved string representation of builtin and standard generic types. Now in the error messages you will see
int
instead ofbuiltins.int
orList
instead oftyping.List
.
v2.5
v2.4
Changes
- Fixed calling
to_dict
method of a class that doesn't haveomit_none
andby_alias
keyword arguments added in case it has a field of the type that has these arguments added:
@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())
v2.3
Changes
- Improved deserialization speed by removing import statements from generated code.
- Fixed using annotations with self-references. See #28.
- Fixed using
SerializableType
data classes. - Fixed getting
UnserializableField
for data classes withoutDataClassDictMixin
parent. - Added a new exception
ThirdPartyModuleNotFoundError
, that is raised in case you usependulum
orciso8601
as the deserialization method, but the corresponding package isn't installed.