mashumaro

Fast and well tested serialization library

APACHE-2.0 License

Downloads
18.5M
Stars
726
Committers
13

Bot releases are hidden (Show)

mashumaro - Latest Release

Published by Fatal1ty 9 months ago

Changes

  • Added support for associating multiple tags with a single variant by returning a list of tags from variant_tagger_fn (#184)
  • Added support for locally defined types (#180, #182, #189)
  • Added support for ForwardRef in JSON Schema generation (#187)
  • Fixed serialization of IntFlag when omit_default is enabled (#188)
  • Improved type annotations for serialization_strategy config option
mashumaro -

Published by Fatal1ty 11 months ago

Changes

  • Added "codecs" feature to separate data models from serialization and work with top-level lists, dataclasses without mixins etc. (#108, #69), see updated documentation
  • Added new allow_deserialization_not_by_alias config option to allow deserialization by both alias and field name, see documentation (https://github.com/Fatal1ty/mashumaro/pull/175)
  • Fixed UnserializableDataError for generic serializable types and generic serialization strategies with postponed evaluation of annotations (#177)
  • Fixed regression when ValueError was not thrown if invalid value type was passed to from_* method
  • Added serialize_by_alias dialect option
  • Added namedtuple_as_dict dialect option
mashumaro -

Published by Fatal1ty about 1 year ago

Changes

  • Added new sort_keys config option to sort keys on serialization, see documentation (#157)
  • Added new omit_default config and dialect options to exclude values equal to defaults on serialization, see documentation (#161)
  • Added variant_tagger_fn discriminator parameter to allow discrimination based on a key that is not part of the model, see documentation (#135)
  • Added new no_copy_collections dialect option to avoid collection data types copying, see documentation (#163)
  • Added support for LiteralString (#166)
  • Added initial support for ForwardRef types (#144)
  • Added ability to use basic types as serialization methods so that they will be reflected in the JSON schema (#148)
  • Added ability to use slots in SerializableType and GenericSerializableType subclasses (#156)
  • Added ability to use frozen dataclasses as dictionary keys (#160)
  • Added support for Python 3.12 (#153)
  • Dropped support for Python 3.7 (#147)
  • Moved from flake8 to ruff (#150)
mashumaro -

Published by Fatal1ty about 1 year ago

Changes

  • Fixed handling of collections of annotated with unhashable metadata types on python < 3.9 (#138)
  • Fixed JSON Schema for inner dataclasses and optional fields with custom serialization methods (#139)
  • Fixed JSON Schema for third-party types with default value (#141)
mashumaro -

Published by Fatal1ty about 1 year ago

Changes

  • Added support for inner dataclasses without mashumaro mixins (#109)
  • Added support for default_factory by JSON Schema generator (#114)
  • Added ability to override additionalProperties in JSON Schema (#123)
  • Added ability to add "description" keyword in JSON Schema by using "description" key in dataclass field metadata (#125)
  • Fixed default reference prefix in JSON Schema 2022-12 dialect (#126)
  • Fixed handling of Annotated type with unhashable metadata (#133)
mashumaro -

Published by Fatal1ty over 1 year ago

Changes

  • Fixed issues introduced in 3.8 when dataclass instantiation produced TypeError if one of the fields was overridden (#118) or post-deserialize hook was used (#120)
mashumaro -

Published by Fatal1ty over 1 year ago

Changes

  • Added new Discriminator type for discriminated unions and subclasses support, see documentation (#106)
  • Added ability to pass custom context from to_* methods to the hooks, see documentation (#110)
  • Types enclosed in Annotated are now different from unenclosed ones in serialization_strategy, see documentation (#115)
  • Added new lazy_compilation config option that can reduce import time and speed up deserialization, see documentation
  • Added support for Final types (#107)
  • Fixed support for Literal on Python 3.9.0 (#103)
  • Added workaround for mypy problem https://github.com/python/mypy/issues/3186 in JSON Schema number constraints
  • Fixed type substitutions in generic SerializableType when TypeVars were mixed with ordinary types in _serialize / _deserialize annotations
  • Fixed an issue where a sentinel value dataclasses.KW_ONLY resulted in UnserializableDataError
  • Fixed an issue where passing a user-defined dict-like object to from_dict method could result in unhandled exceptions
  • Speeded up dataclass instantiation
  • Speeded up deserialization of fields with default values if they are missing in the input data
mashumaro -

Published by Fatal1ty over 1 year ago

Changes

  • Added "omit" serialization engine to skip the field during serialization
  • Added ref_prefix parameter to build_json_schema and JSONSchemaBuilder to change reference prefix
  • Fixed adding dataclass field alias to JSON Schema "required" keyword value. See https://github.com/Fatal1ty/mashumaro/issues/101.
mashumaro -

Published by Fatal1ty over 1 year ago

Changes

  • Added JSON Schema generation functionality 🎉 (see documentation)
    • Draft 2022-12 and OpenAPI Specification 3.1.0
    • Validation keywords using typing.Annotated
    • No mixin required
mashumaro -

Published by Fatal1ty over 1 year ago

Changes

  • Added possibility to define a generic serialization method for a generic type by registering a method for its origin type
  • Improved support for third-party generic types by writing a generic SerializationStrategy (details)
  • Improved writing SerializationStrategy methods by optional use_annotations=True (details)
  • Classes defining __class_getitem__ methods will now be treated as generic types according to PEP 560
mashumaro -

Published by Fatal1ty over 1 year ago

Changes

  • Added support for typing.DefaultDict / collections.defaultdict
  • Added support for generic TypedDict and generic NamedTuple
  • Speeded up the generated code for deserialization of fields that could be None
mashumaro -

Published by Fatal1ty almost 2 years ago

Changes

mashumaro -

Published by Fatal1ty almost 2 years ago

Changes

  • Added ability to use annotations inside SerializableType to simplify dealing with generic types (see updated documentation)
  • Added support for user-defined variadic generic types and dataclasses, TypeVarTuple and Unpack from PEP 646
  • Fixed serialization / deserialization of Tuple[()] on python 3.11
  • Changed type name for Tuple[T, ...] from "Tuple[T, Ellipsis]" to "Tuple[T, ...]"
mashumaro -

Published by Fatal1ty almost 2 years ago

Changes

  • Added support for PEP 655
  • Added skipping None value fields on serialization to TOML format. See https://github.com/Fatal1ty/mashumaro/issues/85.
  • Added new omit_none config option
  • Added new omit_none dialect option
  • Removed allowance to pass None values to fields that can't be None according to their type
  • Speeded up the generated code
  • Dropped Python 3.6 support
mashumaro -

Published by Fatal1ty almost 2 years ago

Changes

mashumaro -

Published by Fatal1ty almost 2 years ago

Changes

  • Added support for Python 3.11
  • Added support for typing.Self and typing_extensions.Self
  • In addition to from_dict and to_dict, methods in other mixins can also be compiled now
  • Increased speed of serialization and deserialization in MessagePack when using DataClassMessagePackMixin:
    • Removed the implicit inclusion of the ADD_DIALECT_SUPPORT config option when using DataClassMessagePackMixin
    • Methods from_msgpack and to_msgpack are now compiled
  • Added DataClassORJSONMixin to use a third-party orjson library that will handle supported data types by itself
    • Added new orjson_options config option to change default options passing to orjson.dumps method
    • Methods to_jsonb and to_json have orjson_options keyword argument to override the default options
  • Added support for TOML format using DataClassTOMLMixin
mashumaro -

Published by Fatal1ty about 2 years ago

Changes

mashumaro -

Published by Fatal1ty over 2 years ago

Changes

mashumaro -

Published by Fatal1ty over 2 years ago

Changes

mashumaro -

Published by Fatal1ty over 2 years ago

Changes