mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.39k stars 432 forks source link

`pkg_resources` is deprecated and removed in Python 3.12 #2485

Open carlosperate opened 6 months ago

carlosperate commented 6 months ago

From the pkg_resources docs: https://setuptools.pypa.io/en/latest/pkg_resources.html

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by packaging (e.g. requirements and version parsing). Users should refrain from new usage of pkg_resources and should work to port to importlib-based solutions.

Python 3.12 has removed pkg_resources from the standard library (moved to setuptools): https://docs.python.org/3/whatsnew/3.12.html

gh-95299: Do not pre-install setuptools in virtual environments created with venv. This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment.

And we use it in the resources/__init__.py file: https://github.com/mu-editor/mu/blob/c38a539aae05cd4e0eaa93a3067addfaf8c7bd3d/mu/resources/__init__.py#L20

Good news is that the importlib_resources backport library contains documentation on how to migrate: https://importlib-resources.readthedocs.io/en/latest/migration.html#pkg-resources-resource-filename

satmandu commented 2 weeks ago

Any chance of getting Python 3.12 support sooner? Ubuntu 24.04 LTS uses Python 3.12 by default.