In Python 3, the collections type classes (e.g. MutableMapping, Iterable) were moved to collections.abc. They were kept in collections for backwards compatibility, but will be removed in Python 3.8 and cause a deprecation warning in Python 3.7.
This leads to deprecation warnings for any Commons consumers, such as Pants.
Solution
Try to import collections.abc, and fall back to collections.
This fallback will be necessary until Commons would ever decide to drop Python 2 support, if that ever would even happen.
Problem
In Python 3, the collections type classes (e.g.
MutableMapping
,Iterable
) were moved tocollections.abc
. They were kept incollections
for backwards compatibility, but will be removed in Python 3.8 and cause a deprecation warning in Python 3.7.This leads to deprecation warnings for any Commons consumers, such as Pants.
Solution
Try to import
collections.abc
, and fall back tocollections
.This fallback will be necessary until Commons would ever decide to drop Python 2 support, if that ever would even happen.