Replaced depreciated pkg_resources with importlib.resources in precalculated_text_measurer.py for Python 3.12 support #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.