question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python 3.9 compatibility (resolve DeprecationWarning from collections)

See original GitHub issue

Issue Summary

Wagtail hits the warning DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working in various places.

Steps to Reproduce

  1. run tox -e py37-dj22-sqlite-noelasticsearch -- --deprecation all
  2. note deprecation warnings:
site-packages/jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
site-packages/jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

resolved by https://github.com/pallets/jinja/pull/867 - the fix is on master not released yet (as of Jinja2==2.10.1)

site-packages/html5lib/_trie/_base.py:3: 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 Mapping

Fixed in https://github.com/html5lib/html5lib-python/issues/402 , but not released yet as of 1.0.1 (see https://github.com/html5lib/html5lib-python/issues/419 )

site-packages/bs4/element.py:1134: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  if not isinstance(formatter, collections.Callable):

https://bugs.launchpad.net/beautifulsoup/+bug/1778909 - resolved by beautifulsoup4>=4.8.0 (and earlier I think)

I’m also seeing one in Wagtail from my own project tests here, the above tox run didn’t seem to hit it:

wagtail/utils/l18n/translation.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

See #5485

  • I have confirmed that this issue can be reproduced as described on a fresh Wagtail project:

yes (on master at bb4e2fe2dfe69fc3143f38c6e34dbe6f2f2f01e0 )

Technical details

  • Python version: Run python --version.

Python 3.7.3

  • Django version: Look in your requirements.txt, or run pip show django | grep Version.

Django 2.2

  • Wagtail version: Look at the bottom of the Settings menu in the Wagtail admin, or run pip show wagtail | grep Version:.

2.7.0.alpha.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
gasmancommented, Oct 24, 2019

@loicteixeira I think it’s a good thing to keep our dependency versions as wide as possible - the fact that we offer Python 3.8 support doesn’t mean that we should lock down our dependencies to only the ones that are 3.8-compatible. At the extreme end, that means that we’re restricting people to a version of Pillow that’s only a few days old.

On one hand, it does mean that early adopters of Python 3.8 may have to figure out the required upgrades for themselves (hopefully nothing that a pip install -U can’t solve); on the other hand, it means that people who are stuck on older versions of libraries for whatever reason (for example: they’re running on a platform like Google AppEngine with limited ability to install server-level packages) aren’t being left stranded.

0reactions
gasmancommented, Nov 2, 2020

Apparently the collections.abc change was deferred again to Python 3.10, but in any case, the final remaining deprecation warning was in botocore (a testing-only dependency), and version-bumping that has resolved it. Will open a PR shortly to make Python 3.9 support official (and current indications are that we’ll be able to support 3.10 with no further changes too).

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's New In Python 3.9 — Python 3.11.1 documentation
With the end of Python 2 support, these backward compatibility layers have been removed, or will be removed soon. Most of them emitted...
Read more >
Fix a deprecation warning of 'collections' · 0617cebcc9 - nova
DeprecationWarning : Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will...
Read more >
How to use collections.abc from both Python 3.8+ and Python ...
./scripts/generateBoard.py:145: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is ...
Read more >
What's New In Python 3.9
With the end of Python 2.7 support, these backward compatibility layers have been removed, or will be removed soon. Most of them emitted...
Read more >
python 3.9 compatibility changes - xtreak blog
Sometimes the deprecations were ignored in large projects like removal of importing ABC from collections module directly that CPython was using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found