-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
migrate importlib to resolve warning about pkg_resources #3061
Conversation
This satisfies the deprecation warnings from https://setuptools.pypa.io/en/latest/pkg_resources.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi. First of all, thanks for contributing! 🎉
We just need to handle the python 3.8 separately in an if
condition, using importlib.resources.open_binary
and importlib.resources.is_resource
for that case.
Also, we could potentially be looking into dropping python 3.8 support soon now that it's approaching EOL. That should make the implementation of this PR simpler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the approach I'm suggesting.
Except the CI seems to be failing, IG we have to do _package_or_requirement = _package_or_requirement.split(".")[0]
in all the functions because we need it to be relative to the main pygame
package and not pygame.pkgdata
submodule.
Co-authored-by: Ankith <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there... Just gotta add # pylint: disable=deprecated-method;
comment in front of the deprecated functions to make pylint happy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, would be good to clear this warning up somewhat from the output (even if we are not really using this file much anymore). I'm familiar with the replacement package and use it for the same purposes in pygame GUI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for contributing! 🥳
I came across this warning when running pytest. I wondered if this fix would be appropriate.
At least on my machine the warning goes away and satisfies the deprecation warning from https://setuptools.pypa.io/en/latest/pkg_resources.html
I think I'm only using this feature for Fonts, so don't know how to check if I have broken anything with this change.