Marshmallow: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

Created on 29 Oct 2018  路  2Comments  路  Source: marshmallow-code/marshmallow

Affected version: marshmallow-2.16.1

Warning examples:

======================================= warnings summary ========================================
.../python3.7/site-packages/marshmallow/schema.py:5: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import defaultdict, Mapping, namedtuple

.../python3.7/site-packages/marshmallow/orderedset.py:26: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  class OrderedSet(collections.MutableSet):

.../python3.7/site-packages/marshmallow/utils.py:54: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  (isinstance(obj, collections.Iterable) and not hasattr(obj, "strip")) or is_generator(obj)

.../venv/lib/python3.7/site-packages/tornado/httputil.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  class HTTPHeaders(collections.MutableMapping):

Maybe it worth to use something like:

try:
    from collections.abc import defaultdict, Mapping, namedtuple
except ImportError:
    from collections import defaultdict, Mapping, namedtuple

Most helpful comment

This is released in 2.16.2

All 2 comments

@nkonin I came across the same deprecation warnings.
Does the proposed PR solve it for you?

This is released in 2.16.2

Was this page helpful?
0 / 5 - 0 ratings