Marshmallow

Latest version: v3.23.1

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

Scan your dependencies

Page 7 of 30

3.3.0

******************

Features:

- ``fields.Nested`` may take a callable that returns a schema instance.
Use this to resolve order-of-declaration issues when schemas nest each other (:issue:`1146`).

.. code-block:: python

<3.3
class AlbumSchema(Schema):
title = fields.Str()
artist = fields.Nested("ArtistSchema", only=("name",))


class ArtistSchema(Schema):
name = fields.Str()
albums = fields.List(fields.Nested(AlbumSchema))


>=3.3
class AlbumSchema(Schema):
title = fields.Str()
artist = fields.Nested(lambda: ArtistSchema(only=("name",)))


class ArtistSchema(Schema):
name = fields.Str()
albums = fields.List(fields.Nested(AlbumSchema))

Deprecations:

- Passing the string ``"self"`` to ``fields.Nested`` is deprecated.
Use a callable instead.

.. code-block:: python

from marshmallow import Schema, fields


<3.3
class PersonSchema(Schema):
partner = fields.Nested("self", exclude=("partner",))
friends = fields.List(fields.Nested("self"))


>=3.3
class PersonSchema(Schema):
partner = fields.Nested(lambda: PersonSchema(exclude=("partner")))
friends = fields.List(fields.Nested(lambda: PersonSchema()))

Other changes:

- Fix typing for ``Number._format_num`` (:pr:`1466`). Thanks :user:`hukkinj1`.
- Make mypy stricter and remove dead code (:pr:`1467`). Thanks again, :user:`hukkinj1`.

3.2.2

******************

Bug fixes:

- Don't load fields for which ``load_only`` and ``dump_only`` are both ``True`` (:pr:`1448`).
- Fix types in ``marshmallow.validate`` (:pr:`1446`).

Support:

- Test against Python 3.8 (:pr:`1431`).

3.2.1

++++++++++++++++++

Bug fixes:

- Fix typing for ``Schema.dump[s]`` (:pr:`1416`).

3.2.0

++++++++++++++++++

Features:

- Add type annotations to ``marshmallow.schema`` and ``marshmallow.validate`` (:pr:`1407`, :issue:`663`).

Bug fixes:

- Fix compatibility with Python < 3.5.3 (:issue:`1409`). Thanks :user:`lukaszdudek-silvair` for reporting.

Refactoring:

- Remove unnecessary ``BaseSchema`` superclass (:pr:`1406`).

3.1.1

++++++++++++++++++

Bug fixes:

- Restore inheritance hierarchy of ``Number`` fields (:pr:`1403`).
``fields.Integer`` and ``fields.Decimal`` inherit from ``fields.Number``.
- Fix bug that raised an uncaught error when a nested schema instance had an unpickleable object in its context (:issue:`1404`).
Thanks :user:`metheoryt` for reporting.

3.1.0

++++++++++++++++++

Features:

- Add more type annotations (:issue:`663`).
Type information is distributed per `PEP 561 <https://www.python.org/dev/peps/pep-0561/>`_ .
Thanks :user:`fuhrysteve` for helping with this.

Bug fixes:

- Includes bug fix from 2.20.5.

Page 7 of 30

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.