robertlugg / easygui

easygui for Python
http://easygui.readthedocs.org/en/master/
BSD 3-Clause "New" or "Revised" License
451 stars 114 forks source link

move to collections.abc sooner #204

Open tomhea opened 2 years ago

tomhea commented 2 years ago

Hi!

Just noticed that the deprecation warning of importing from 'collections' instead of from 'collections.abc' (the reason for version 0.98.3) seems to be sooner than python 3.10, according to the message I just got using python 3.8.8 (anaconda):

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 stop working

It collides with the what's written in the code, only switching the import at python 3.10, not 3.9

Moreover, in version python 3.8 it still issues a warning when importing from collections.

I suggest importing from collections.abc in default, and importing from collections if sys.version_info < (3, 3) (which is the version collections.abc was first introduced).

My worries are that in python 3.9 the module might not work, and that users from previous versions might see a warning each time they use this module.

zadacka commented 2 years ago

That is a good point.

The reason why we switched at v3.10 was that subsequent versions of Python had completely moved the import and did not provide a back-portable alias. However, as you have pointed out, the intermediate versions (3.3->3.9) will emit deprecation warnings which is noisy and easily avoidable.

Thanks for raising this - I'll aim to switch the import location from an earlier version and this will stop the noise.

tomhea commented 1 year ago

@zadacka Hi! it still bothers me so I pull-requested (#205) the patched version :)

zadacka commented 1 year ago

Thank you - yep, given that the new import is already available we might as well change it to use the newer one.

On Tue, 2 Aug 2022 at 23:31, tomhea @.***> wrote:

@zadacka https://github.com/zadacka Hi! it still bothers me so I pull-requested (#205 https://github.com/robertlugg/easygui/pull/205) the patched version :)

— Reply to this email directly, view it on GitHub https://github.com/robertlugg/easygui/issues/204#issuecomment-1203276885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2XZIODZNVBOOYL7XVA7TTVXGOULANCNFSM5YEBRJRQ . You are receiving this because you were mentioned.Message ID: @.***>