twitter-archive / commons

Twitter common libraries for python and the JVM (deprecated)
http://twitter.github.com/commons
Other
2.1k stars 565 forks source link

Fix collections.abc deprecation #474

Closed Eric-Arellano closed 5 years ago

Eric-Arellano commented 5 years ago

Problem

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.

CLAassistant commented 5 years ago

CLA assistant check
All committers have signed the CLA.

Eric-Arellano commented 5 years ago

cc @stuhood @kwlzn