Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced depreciated pkg_resources with importlib.resources in precalculated_text_measurer.py for Python 3.12 support #45

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ashrobertsdragon
Copy link

I had the same issue as issue #44 pkg_resources is not available by default in Python 3.12. The library pkg_resources was removed from Python in version 3.12 and users are directed to use the resources module in importlib instead. The code is a little different because the methods resource_exists doesn't exist in importlub.resources but naming a files object and then checking to see if it exists seems to do the trick.

I have also had to update Pillow to 10.1 and requests to 2.32.3 as these are the oldest (non-yanked in the case of requests) versions that support Python 3.12. Unfortunately, these versions remove support for Python 3.7, so I also updated the minimum version to 3.8 (the python_requires line of setup.py was still set at 3.4). I also updated xmldiff to version 2.6, also the oldest version to support Python 3.12. nox passed with the xmldiff 2.4, but with warnings.

Note: as is, this version will not support Python 3.13 when it is released. nox provided the following depreciation warning:
pybadges_init_.py:33: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13

This is my first pull request aside for the one I accidentally opened on my own repo, but I've read a few others. I have read and followed the contributing guidelines and code of conduct. I have run nox on this branch. It passed all the tests it could run on my machine (type_check is not supported on Windows). I have submitted the required Contributer's License Agreement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant