Skip to content

Commit

Permalink
Include affected keyword argument names in metadata deprecation warni…
Browse files Browse the repository at this point in the history
…ng (#1882)

* Include affected keyword argument names in metadata deprecation warning

* Improve warning copy

Co-authored-by: Steven Loria <[email protected]>
  • Loading branch information
traherom and sloria authored Oct 17, 2021
1 parent ce69a11 commit bfd2593
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,5 @@ Contributors (chronological)
- Javier Fernández `@jfernandz <https://github.com/jfernandz>`_
- Michael Dimchuk `@michaeldimchuk <https://github.com/michaeldimchuk>`_
- Jochen Kupperschmidt `@homeworkprod <https://github.com/homeworkprod>`_
- `@yourun-proger <https://github.com/yourun-proger>`_
- `@yourun-proger <https://github.com/yourun-proger>`_
- Ryan Morehart '@traherom <https://github.com/traherom>`_
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ 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
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`).
Expand Down
5 changes: 3 additions & 2 deletions src/marshmallow/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ def __init__(
self.metadata = {**metadata, **additional_metadata}
if additional_metadata:
warnings.warn(
"Passing field metadata as a keyword arg is deprecated. Use the "
"explicit `metadata=...` argument instead.",
"Passing field metadata as keyword arguments is deprecated. Use the "
"explicit `metadata=...` argument instead. "
f"Additional metadata: {additional_metadata}",
RemovedInMarshmallow4Warning,
)

Expand Down

0 comments on commit bfd2593

Please sign in to comment.