Changelog
### 3.22.0
```
*******************
Features:
- Add ``many`` Meta option to ``Schema`` so it expects a collection by default (:issue:`2270`).
Thanks :user:`himalczyk` for reporting and :user:`deckar01` for the PR.
- Refactor hooks (:pr:`2279`).
Thanks :user:`deckar01` for the PR.
```
### 3.21.3
```
*******************
Bug fixes:
- Fix memory leak that prevented schema instances from getting GC'd (:pr:`2277`).
Thanks :user:`mrcljx` for the PR.
```
### 3.21.2
```
*******************
Bug fixes:
- Allow timestamp 0 in ``fields.DateTime`` (:issue:`2133`).
Thanks :user:`flydzen` for reporting.
```
### 3.21.1
```
*******************
Bug fixes:
- Fix error message when field is declared as a class and not an instance (:issue:`2245`).
Thanks :user:`travnick` for reporting.
```
### 3.21.0
```
*******************
Bug fixes:
- Fix validation of ``URL`` fields to allow missing user field,
per NWG RFC 3986 (:issue:`2232`). Thanks :user:`ddennerline3` for reporting
and :user:`deckar01` for the PR.
Other changes:
- *Backwards-incompatible*: ``__version__``, ``__parsed_version__``, and ``__version_info__``
attributes are deprecated (:issue:`2227`). Use feature detection or
``importlib.metadata.version("marshmallow")`` instead.
```
### 3.20.2
```
*******************
Bug fixes:
- Fix ``Nested`` field type hint for lambda ``Schema`` types (:pr:`2164`).
Thanks :user:`somethingnew2-0` for the PR.
Other changes:
- Officially support Python 3.12 (:pr:`2188`).
Thanks :user:`hugovk` for the PR.
```
### 3.20.1
```
*******************
Bug fixes:
- Fix call to ``get_declared_fields``: pass ``dict_cls`` again (:issue:`2152`).
Thanks :user:`Cheaterman` for reporting.
```
### 3.20.0
```
*******************
Features:
- Add ``absolute`` parameter to ``URL`` validator and ``Url`` field (:pr:`2123`).
Thanks :user:`sirosen` for the PR.
- Use Abstract Base Classes to define ``FieldABC`` and ``SchemaABC``
(:issue:`1449`). Thanks :user:`aditkumar72` for the PR.
- Use `OrderedSet` as default `set_class`. Schemas are now ordered by default.
(:issue:`1744`)
Bug fixes:
- Handle ``OSError`` and ``OverflowError`` in ``utils.from_timestamp`` (:pr:`2102`).
Thanks :user:`TheBigRoomXXL` for the PR.
- Fix the default inheritance of nested partial schemas (:issue:`2149`).
Thanks :user:`matejsp` for reporting.
Other changes:
- Officially support Python 3.11 (:pr:`2067`).
- Drop support for Python 3.7 (:pr:`2135`).
```
### 3.19.0
```
*******************
Features:
- Add ``timestamp`` and ``timestamp_ms`` formats to ``fields.DateTime``
(:issue:`612`).
Thanks :user:`vgavro` for the suggestion and thanks :user:`vanHoi` for
the PR.
```
### 3.18.0
```
*******************
Features:
- Add ``Enum`` field (:pr:`2017`) and (:pr:`2044`).
Bug fixes:
- Fix typing in ``Field._serialize`` signature (:pr:`2046`).
```
### 3.17.1
```
*******************
Bug fixes:
- Add return type to ``fields.Email.__init__`` (:pr:`2018`).
Thanks :user:`kkirsche` for the PR.
- Add missing type hint to IPInterface __init__ (:pr:`2036`).
```
### 3.17.0
```
*******************
Features:
- Support serialization as float in ``TimeDelta`` field (:pr:`1998`).
Thanks :user:`marcosatti` for the PR.
- Add ``messages_dict`` property to ``ValidationError`` to facilitate type checking
(:pr:`1976`).
Thanks :user:`sirosen` for the PR.
```
### 3.16.0
```
*******************
Features:
- Raise ``ValueError`` if an invalid value is passed to the ``unknown``
argument (:issue:`1721`, :issue:`1732`).
Thanks :user:`sirosen` for the PR.
Other changes:
- Set lower bound for ``packaging`` requirement (:issue:`1957`).
Thanks :user:`MatthewNicolTR` for reporting and thanks :user:`sirosen` for the PR.
- Improve warning messages by passing ``stacklevel`` (:pr:`1986`).
Thanks :user:`tirkarthi` for the PR.
```
### 3.15.0
```
*******************
Features:
- Allow passing a ``dict`` to ``fields.Nested`` (:pr:`1935`).
Thanks :user:`sirosen` for the PR.
Other changes:
- Address distutils deprecation warning in Python 3.10 (:pr:`1903`).
Thanks :user:`kkirsche` for the PR.
- Add py310 to black target-version (:pr:`1921`).
- Drop support for Python 3.6 (:pr:`1923`).
- Use postponed evaluation of annotations (:pr:`1932`).
Thanks :user:`Isira-Seneviratne` for the PR.
```
### 3.14.1
```
*******************
Bug fixes:
- Fix publishing type hints per `PEP-561 <https://www.python.org/dev/peps/pep-0561/>`_
(:pr:`1905`). Thanks :user:`bwindsor` for the catch and patch.
```
### 3.14.0
```
*******************
Bug fixes:
- Fix ``fields.TimeDelta`` serialization precision (:issue:`1865`).
Thanks :user:`yarsanich` for reporting.
Other changes:
- Fix type-hints for ``data`` arg in ``Schema.validate`` to accept
list of dictionaries (:issue:`1790`, :pr:`1868`).
Thanks :user:`yourun-proger` for PR.
- Improve warning when passing metadata as keyword arguments (:pr:`1882`).
Thanks :user:`traherom` for the PR.
- Don't build universal wheels. We don't support Python 2 anymore.
(:issue:`1860`) Thanks :user:`YKdvd` for reporting.
- Make the build reproducible (:pr:`1862`).
- Drop support for Python 3.5 (:pr:`1863`).
- Test against Python 3.10 (:pr:`1888`).
```
### 3.13.0
```
*******************
Features:
- Replace ``missing``/``default`` field parameters with
``load_default``/``dump_default`` (:pr:`1742`).
Thanks :user:`sirosen` for the PR.
Deprecations:
- The use of ``missing``/``default`` field parameters is deprecated and will be
removed in marshmallow 4. ``load_default``/``dump_default`` should be used
instead.
```
### 3.12.2
```
*******************
Bug fixes:
- Don't expose ``Field``\s as ``Schema`` attributes. This reverts a change
introduced in 3.12.0 that causes issues when field names conflict with
``Schema`` attributes or methods. ``Fields``\s are still accessible on a
``Schema`` instance through the ``fields`` attribute. (:pr:`1843`)
```
### 3.12.1
```
*******************
Bug fixes:
- Fix bug that raised an ``AttributeError`` when instantiating a
``Schema`` with a field named ``parent`` (:issue:`1808`).
Thanks :user:`flying-sheep` for reporting and helping with the fix.
```
### 3.12.0
```
*******************
Features:
- Add ``validate.And`` (:issue:`1768`).
Thanks :user:`rugleb` for the suggestion.
- Add type annotations to ``marshmallow.decorators`` (:issue:`1788`, :pr:`1789`).
Thanks :user:`michaeldimchuk` for the PR.
- Let ``Field``\s be accessed by name as ``Schema`` attributes (:pr:`1631`).
Other changes:
- Improve types in ``marshmallow.validate`` (:pr:`1786`).
- Make ``marshmallow.validate.Validator`` an abstract base class (:pr:`1786`).
- Remove unnecessary list cast (:pr:`1785`).
```
### 3.11.1
```
*******************
Bug fixes:
- Fix treatment of dotted keys when ``unknown=INCLUDE`` (:issue:`1506`).
Thanks :user:`rbu` for reporting and thanks :user:`sirosen` for the fix (:pr:`1745`).
```
### 3.11.0
```
*******************
Features:
- Add ``fields.IPInterface``, ``fields.IPv4Interface``, and
``IPv6Interface`` (:issue:`1733`). Thanks :user:`madeinoz67`
for the suggestion and the PR.
- Raise ``AttributeError`` for missing methods when using ``fields.Method`` (:pr:`1675`).
Thanks :user:`lassandroan`.
Other changes:
- Remove unnecessary ``hasattr`` and ``getattr`` checks in ``Field`` (:pr:`1770`).
```
### 3.10.0
```
*******************
Deprecations:
- Passing field metadata via keyword arguments is deprecated and will be
removed in marshmallow 4 (:issue:`1350`). Use the explicit ``metadata=...``
argument instead. Thanks :user:`sirosen`.
```
### 3.9.1
```
******************
Bug fixes:
- Cast to mapping type in ``Mapping.serialize`` and ``Mapping.deserialize``
(:pr:`1685`).
- Fix bug letting ``Dict`` pass invalid dict on deserialization when no key or
value ``Field`` is specified (:pr:`1685`).
```
### 3.9.0
```
******************
Features:
- Add ``format`` argument to ``fields.Time`` and ``timeformat`` ``class Meta`` option (:issue:`686`).
Thanks :user:`BennyAlex` for the suggestion and thanks :user:`infinityxxx` for the PR.
Other changes:
- Remove usage of implicit ``typing.Optional`` (:issue:`1663`).
Thanks :user:`nadega` for the PR.
```
### 3.8.0
```
******************
Features:
- Add ``fields.IP``, ``fields.IPv4`` and ``fields.IPv6`` (:pr:`1485`). Thanks
:user:`mgetka` for the PR.
Bug fixes:
- Fix typing in ``AwareDateTime`` (:pr:`1658`). Thanks :user:`adithyabsk` for
reporting.
```
### 3.7.1
```
******************
Bug fixes:
- ``fields.Boolean`` correctly serializes non-hashable types (:pr:`1633`).
Thanks :user:`jun0jang` for the PR.
```
### 3.7.0
```
******************
Deprecations:
- ``marshmallow.pprint`` is deprecated and will be removed in marshmallow 4 (:issue:`1588`).
Support:
- Document ``default_error_messages`` on field classes (:pr:`1619`). Thanks :user:`weeix`.
Bug fixes:
- Fix passing ``only`` and ``exclude`` to ``Nested`` with an ordered ``Schema`` (:pr:`1627`).
Thanks :user:`juannorris` for the PR.
```
### 3.6.1
```
******************
No code changes--only docs and contributor-facing updates in this release.
Support:
- Documentation: improve custom fields example (:issue:`1538`).
Thanks :user:`pablospizzamiglio` for reporting the problem with the
old example and thanks :user:`Resinderate` for the PR.
- Documentation: Split up API reference into multiple pages and
add summary tables (:pr:`1587`). Thanks :user:`EpicWink` for the PR.
```
### 3.6.0
```
******************
Features:
- Add ``validate.ContainsNoneOf`` (:issue:`1528`).
Thanks :user:`Resinderate` for the suggestion and the PR.
```
### 3.5.2
```
******************
Bug fixes:
- Fix typing in ``class_registry`` (:pr:`1574`). Thanks :user:`mahenzon`.
```
### 3.5.1
```
******************
Bug fixes:
- Includes bug fix from 2.21.0.
```
### 3.5.0
```
******************
Bug fixes:
- Fix list of nullable nested fields ``List(Nested(Field, allow_none=True)``
(:issue:`1497`). Because this fix reverts an optimization introduced to
speed-up serialization and deserialization of lists of nested fields, a
negative impact on performance in this specific case is expected.
```
### 3.4.0
```
******************
Features:
- Improve type coverage (:issue:`1479`). Thanks :user:`Reskov`.
Bug fixes:
- Fix typing for ``data`` param of ``Schema.load`` and ``ValidationError`` (:issue:`1492`).
Thanks :user:`mehdigmira` for reporting and thanks :user:`dfirst` for the PR.
Other changes:
- Remove unnecessary typecasts (:pr:`1500`). Thanks :user:`hukkinj1`.
- Remove useless ``_serialize`` override in ``UUID`` field (:pr:`1489`).
```
Links
- PyPI: https://pypi.org/project/marshmallow
- Changelog: https://data.safetycli.com/changelogs/marshmallow/
This PR updates marshmallow from 3.3.0 to 3.22.0.
Changelog
### 3.22.0 ``` ******************* Features: - Add ``many`` Meta option to ``Schema`` so it expects a collection by default (:issue:`2270`). Thanks :user:`himalczyk` for reporting and :user:`deckar01` for the PR. - Refactor hooks (:pr:`2279`). Thanks :user:`deckar01` for the PR. ``` ### 3.21.3 ``` ******************* Bug fixes: - Fix memory leak that prevented schema instances from getting GC'd (:pr:`2277`). Thanks :user:`mrcljx` for the PR. ``` ### 3.21.2 ``` ******************* Bug fixes: - Allow timestamp 0 in ``fields.DateTime`` (:issue:`2133`). Thanks :user:`flydzen` for reporting. ``` ### 3.21.1 ``` ******************* Bug fixes: - Fix error message when field is declared as a class and not an instance (:issue:`2245`). Thanks :user:`travnick` for reporting. ``` ### 3.21.0 ``` ******************* Bug fixes: - Fix validation of ``URL`` fields to allow missing user field, per NWG RFC 3986 (:issue:`2232`). Thanks :user:`ddennerline3` for reporting and :user:`deckar01` for the PR. Other changes: - *Backwards-incompatible*: ``__version__``, ``__parsed_version__``, and ``__version_info__`` attributes are deprecated (:issue:`2227`). Use feature detection or ``importlib.metadata.version("marshmallow")`` instead. ``` ### 3.20.2 ``` ******************* Bug fixes: - Fix ``Nested`` field type hint for lambda ``Schema`` types (:pr:`2164`). Thanks :user:`somethingnew2-0` for the PR. Other changes: - Officially support Python 3.12 (:pr:`2188`). Thanks :user:`hugovk` for the PR. ``` ### 3.20.1 ``` ******************* Bug fixes: - Fix call to ``get_declared_fields``: pass ``dict_cls`` again (:issue:`2152`). Thanks :user:`Cheaterman` for reporting. ``` ### 3.20.0 ``` ******************* Features: - Add ``absolute`` parameter to ``URL`` validator and ``Url`` field (:pr:`2123`). Thanks :user:`sirosen` for the PR. - Use Abstract Base Classes to define ``FieldABC`` and ``SchemaABC`` (:issue:`1449`). Thanks :user:`aditkumar72` for the PR. - Use `OrderedSet` as default `set_class`. Schemas are now ordered by default. (:issue:`1744`) Bug fixes: - Handle ``OSError`` and ``OverflowError`` in ``utils.from_timestamp`` (:pr:`2102`). Thanks :user:`TheBigRoomXXL` for the PR. - Fix the default inheritance of nested partial schemas (:issue:`2149`). Thanks :user:`matejsp` for reporting. Other changes: - Officially support Python 3.11 (:pr:`2067`). - Drop support for Python 3.7 (:pr:`2135`). ``` ### 3.19.0 ``` ******************* Features: - Add ``timestamp`` and ``timestamp_ms`` formats to ``fields.DateTime`` (:issue:`612`). Thanks :user:`vgavro` for the suggestion and thanks :user:`vanHoi` for the PR. ``` ### 3.18.0 ``` ******************* Features: - Add ``Enum`` field (:pr:`2017`) and (:pr:`2044`). Bug fixes: - Fix typing in ``Field._serialize`` signature (:pr:`2046`). ``` ### 3.17.1 ``` ******************* Bug fixes: - Add return type to ``fields.Email.__init__`` (:pr:`2018`). Thanks :user:`kkirsche` for the PR. - Add missing type hint to IPInterface __init__ (:pr:`2036`). ``` ### 3.17.0 ``` ******************* Features: - Support serialization as float in ``TimeDelta`` field (:pr:`1998`). Thanks :user:`marcosatti` for the PR. - Add ``messages_dict`` property to ``ValidationError`` to facilitate type checking (:pr:`1976`). Thanks :user:`sirosen` for the PR. ``` ### 3.16.0 ``` ******************* Features: - Raise ``ValueError`` if an invalid value is passed to the ``unknown`` argument (:issue:`1721`, :issue:`1732`). Thanks :user:`sirosen` for the PR. Other changes: - Set lower bound for ``packaging`` requirement (:issue:`1957`). Thanks :user:`MatthewNicolTR` for reporting and thanks :user:`sirosen` for the PR. - Improve warning messages by passing ``stacklevel`` (:pr:`1986`). Thanks :user:`tirkarthi` for the PR. ``` ### 3.15.0 ``` ******************* Features: - Allow passing a ``dict`` to ``fields.Nested`` (:pr:`1935`). Thanks :user:`sirosen` for the PR. Other changes: - Address distutils deprecation warning in Python 3.10 (:pr:`1903`). Thanks :user:`kkirsche` for the PR. - Add py310 to black target-version (:pr:`1921`). - Drop support for Python 3.6 (:pr:`1923`). - Use postponed evaluation of annotations (:pr:`1932`). Thanks :user:`Isira-Seneviratne` for the PR. ``` ### 3.14.1 ``` ******************* Bug fixes: - Fix publishing type hints per `PEP-561 <https://www.python.org/dev/peps/pep-0561/>`_ (:pr:`1905`). Thanks :user:`bwindsor` for the catch and patch. ``` ### 3.14.0 ``` ******************* Bug fixes: - Fix ``fields.TimeDelta`` serialization precision (:issue:`1865`). Thanks :user:`yarsanich` for reporting. Other changes: - Fix type-hints for ``data`` arg in ``Schema.validate`` to accept list of dictionaries (:issue:`1790`, :pr:`1868`). Thanks :user:`yourun-proger` for PR. - Improve warning when passing metadata as keyword arguments (:pr:`1882`). Thanks :user:`traherom` for the PR. - Don't build universal wheels. We don't support Python 2 anymore. (:issue:`1860`) Thanks :user:`YKdvd` for reporting. - Make the build reproducible (:pr:`1862`). - Drop support for Python 3.5 (:pr:`1863`). - Test against Python 3.10 (:pr:`1888`). ``` ### 3.13.0 ``` ******************* Features: - Replace ``missing``/``default`` field parameters with ``load_default``/``dump_default`` (:pr:`1742`). Thanks :user:`sirosen` for the PR. Deprecations: - The use of ``missing``/``default`` field parameters is deprecated and will be removed in marshmallow 4. ``load_default``/``dump_default`` should be used instead. ``` ### 3.12.2 ``` ******************* Bug fixes: - Don't expose ``Field``\s as ``Schema`` attributes. This reverts a change introduced in 3.12.0 that causes issues when field names conflict with ``Schema`` attributes or methods. ``Fields``\s are still accessible on a ``Schema`` instance through the ``fields`` attribute. (:pr:`1843`) ``` ### 3.12.1 ``` ******************* Bug fixes: - Fix bug that raised an ``AttributeError`` when instantiating a ``Schema`` with a field named ``parent`` (:issue:`1808`). Thanks :user:`flying-sheep` for reporting and helping with the fix. ``` ### 3.12.0 ``` ******************* Features: - Add ``validate.And`` (:issue:`1768`). Thanks :user:`rugleb` for the suggestion. - Add type annotations to ``marshmallow.decorators`` (:issue:`1788`, :pr:`1789`). Thanks :user:`michaeldimchuk` for the PR. - Let ``Field``\s be accessed by name as ``Schema`` attributes (:pr:`1631`). Other changes: - Improve types in ``marshmallow.validate`` (:pr:`1786`). - Make ``marshmallow.validate.Validator`` an abstract base class (:pr:`1786`). - Remove unnecessary list cast (:pr:`1785`). ``` ### 3.11.1 ``` ******************* Bug fixes: - Fix treatment of dotted keys when ``unknown=INCLUDE`` (:issue:`1506`). Thanks :user:`rbu` for reporting and thanks :user:`sirosen` for the fix (:pr:`1745`). ``` ### 3.11.0 ``` ******************* Features: - Add ``fields.IPInterface``, ``fields.IPv4Interface``, and ``IPv6Interface`` (:issue:`1733`). Thanks :user:`madeinoz67` for the suggestion and the PR. - Raise ``AttributeError`` for missing methods when using ``fields.Method`` (:pr:`1675`). Thanks :user:`lassandroan`. Other changes: - Remove unnecessary ``hasattr`` and ``getattr`` checks in ``Field`` (:pr:`1770`). ``` ### 3.10.0 ``` ******************* Deprecations: - Passing field metadata via keyword arguments is deprecated and will be removed in marshmallow 4 (:issue:`1350`). Use the explicit ``metadata=...`` argument instead. Thanks :user:`sirosen`. ``` ### 3.9.1 ``` ****************** Bug fixes: - Cast to mapping type in ``Mapping.serialize`` and ``Mapping.deserialize`` (:pr:`1685`). - Fix bug letting ``Dict`` pass invalid dict on deserialization when no key or value ``Field`` is specified (:pr:`1685`). ``` ### 3.9.0 ``` ****************** Features: - Add ``format`` argument to ``fields.Time`` and ``timeformat`` ``class Meta`` option (:issue:`686`). Thanks :user:`BennyAlex` for the suggestion and thanks :user:`infinityxxx` for the PR. Other changes: - Remove usage of implicit ``typing.Optional`` (:issue:`1663`). Thanks :user:`nadega` for the PR. ``` ### 3.8.0 ``` ****************** Features: - Add ``fields.IP``, ``fields.IPv4`` and ``fields.IPv6`` (:pr:`1485`). Thanks :user:`mgetka` for the PR. Bug fixes: - Fix typing in ``AwareDateTime`` (:pr:`1658`). Thanks :user:`adithyabsk` for reporting. ``` ### 3.7.1 ``` ****************** Bug fixes: - ``fields.Boolean`` correctly serializes non-hashable types (:pr:`1633`). Thanks :user:`jun0jang` for the PR. ``` ### 3.7.0 ``` ****************** Deprecations: - ``marshmallow.pprint`` is deprecated and will be removed in marshmallow 4 (:issue:`1588`). Support: - Document ``default_error_messages`` on field classes (:pr:`1619`). Thanks :user:`weeix`. Bug fixes: - Fix passing ``only`` and ``exclude`` to ``Nested`` with an ordered ``Schema`` (:pr:`1627`). Thanks :user:`juannorris` for the PR. ``` ### 3.6.1 ``` ****************** No code changes--only docs and contributor-facing updates in this release. Support: - Documentation: improve custom fields example (:issue:`1538`). Thanks :user:`pablospizzamiglio` for reporting the problem with the old example and thanks :user:`Resinderate` for the PR. - Documentation: Split up API reference into multiple pages and add summary tables (:pr:`1587`). Thanks :user:`EpicWink` for the PR. ``` ### 3.6.0 ``` ****************** Features: - Add ``validate.ContainsNoneOf`` (:issue:`1528`). Thanks :user:`Resinderate` for the suggestion and the PR. ``` ### 3.5.2 ``` ****************** Bug fixes: - Fix typing in ``class_registry`` (:pr:`1574`). Thanks :user:`mahenzon`. ``` ### 3.5.1 ``` ****************** Bug fixes: - Includes bug fix from 2.21.0. ``` ### 3.5.0 ``` ****************** Bug fixes: - Fix list of nullable nested fields ``List(Nested(Field, allow_none=True)`` (:issue:`1497`). Because this fix reverts an optimization introduced to speed-up serialization and deserialization of lists of nested fields, a negative impact on performance in this specific case is expected. ``` ### 3.4.0 ``` ****************** Features: - Improve type coverage (:issue:`1479`). Thanks :user:`Reskov`. Bug fixes: - Fix typing for ``data`` param of ``Schema.load`` and ``ValidationError`` (:issue:`1492`). Thanks :user:`mehdigmira` for reporting and thanks :user:`dfirst` for the PR. Other changes: - Remove unnecessary typecasts (:pr:`1500`). Thanks :user:`hukkinj1`. - Remove useless ``_serialize`` override in ``UUID`` field (:pr:`1489`). ```Links
- PyPI: https://pypi.org/project/marshmallow - Changelog: https://data.safetycli.com/changelogs/marshmallow/