Webargs

Latest version: v8.4.0

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

Scan your dependencies

Page 1 of 17

8.4.0

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

Features:

* Add a new class attribute, ``empty_value`` to ``DelimitedList`` and
``DelimitedTuple``, with a default of ``""``.
This controls the value deserialized when an empty string is seen.

``empty_value`` can be used to handle types other than strings more gracefully, e.g.

.. code-block:: python

from webargs import fields


class IntList(fields.DelimitedList):
empty_value = 0


myfield = IntList(fields.Int())

.. note::

``empty_value`` will be changing in webargs v9.0 to be ``missing`` by
default. This will allow use of fields with ``load_default`` to specify
handling of the empty value.

* The rule for default argument names has been made configurable by overriding
the ``get_default_arg_name`` method. This is described in the argument
passing documentation.

Other changes:

* Drop support for Python 3.7, which is EOL.
* Type annotations for ``FlaskParser`` have been improved.

8.3.0

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

Features:

* ``webargs.Parser`` now inherits from ``typing.Generic`` and is parametrizable
over the type of the request object. Various framework-specific parsers are
parametrized over their relevant request object classes.

* ``webargs.Parser`` and its subclasses now support passing arguments as a
single keyword argument without expanding the parsed data into its
components. For more details, see advanced docs on
``Argument Passing and arg_name``.

Other changes:

* Type annotations have been improved to allow ``Mapping`` for dict-like
schemas where previously ``dict`` was used. This makes the type covariant
rather than invariant (:issue:`836`).

* Test against Python 3.11 (:pr:`787`).

8.2.0

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

Features:

* A new method, ``webargs.Parser.async_parse``, can be used for async-aware
parsing from the base parser class. This can handle async location loader
functions and async error handlers.

* ``webargs.Parser.use_args`` and ``use_kwargs`` can now be used to decorate
async functions, and will use ``async_parse`` if the decorated function is
also async. They will call the non-async ``parse`` method when used to
decorate non-async functions.

* As a result of the changes to ``webargs.Parser``, ``FlaskParser``,
``DjangoParser``, and ``FalconParser`` now all support async views.
Thanks :user:`Isira-Seneviratne` for the initial PR.

Changes:

* The implementation of ``AsyncParser`` has changed. Now that
``webargs.Parser`` has built-in support for async usage, the primary
purpose of ``AsyncParser`` is to redefine ``parse`` as an alias for
``async_parse``

* Set ``python_requires>=3.7.2`` in package metadata (:pr:`692`).
Thanks :user:`kasium` for the PR.

8.1.0

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

Bug fixes:

* Fix publishing type hints per `PEP-561 <https://www.python.org/dev/peps/pep-0561/>`_.
(:pr:`650`).
* Add DelimitedTuple to fields.__all__ (:pr:`678`).
* Narrow type of ``argmap`` from ``Mapping`` to ``Dict`` (:pr:`682`).

Other changes:

* Test against Python 3.10 (:pr:`647`).
* Drop support for Python 3.6 (:pr:`673`).
* Address distutils deprecation warning in Python 3.10 (:pr:`652`).
Thanks :user:`kkirsche` for the PR.
* Use postponed evaluation of annotations (:pr:`663`).
Thanks :user:`Isira-Seneviratne` for the PR.
* Pin mypy version in tox (:pr:`674`).
* Improve type annotations for ``__version_info__`` (:pr:`680`).

8.0.1

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

Bug fixes:

* Fix "``DelimitedList`` deserializes empty string as ``['']``" (:issue:`623`).
Thanks :user:`TTWSchell` for reporting and for the PR.

Other changes:

* New documentation theme with `furo`. Thanks to :user:`pradyunsg` for writing
furo!
* Webargs has a new logo. Thanks to :user:`michaelizergit`! (:issue:`312`)
* Don't build universal wheels. We don't support Python 2 anymore.
(:pr:`632`)
* Make the build reproducible (:pr:`631`).

8.0.0

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

Features:

* Add `Parser.pre_load` as a method for allowing users to modify data before
schema loading, but without redefining location loaders. See advanced docs on
`Parser pre_load` for usage information. (:pr:`583`)

* *Backwards-incompatible*: ``unknown`` defaults to `None` for body locations
(`json`, `form` and `json_or_form`) (:issue:`580`).

* Detection of fields as "multi-value" for unpacking lists from multi-dict
types is now extensible with the ``is_multiple`` attribute. If a field sets
``is_multiple = True`` it will be detected as a multi-value field. If
``is_multiple`` is not set or is set to ``None``, webargs will check if the
field is an instance of ``List`` or ``Tuple``. (:issue:`563`)

* A new attribute on ``Parser`` objects, ``Parser.KNOWN_MULTI_FIELDS`` can be
used to set fields which should be detected as ``is_multiple=True`` even when
the attribute is not set (:pr:`592`).

See docs on "Multi-Field Detection" for more details.

Bug fixes:

* ``Tuple`` field now behaves as a "multiple" field (:pr:`585`).

Page 1 of 17

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.