-
Notifications
You must be signed in to change notification settings - Fork 271
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
ENH: migrate from pkg_resources to importlib.resources on Python 3.9+ #4292
ENH: migrate from pkg_resources to importlib.resources on Python 3.9+ #4292
Conversation
setupext.py
Outdated
@@ -205,7 +204,7 @@ def check_for_pyembree(std_libs): | |||
embree_libs = [] | |||
embree_aliases = {} | |||
try: | |||
_ = resource_filename("pyembree", "rtcore.pxd") | |||
_ = importlib.resources.files("pyembree") / "rtcore.pxd" |
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.
this doesn't need changes on the pyembree side, right?
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.
It doesn't. It works exactly like pkg_resources
except that it returns a Path
object instead of a string.
In hindsight it's completely useless (in both implementations) to look for an exact file like we do here, because both implementations are happy to produce a path to a file even if it's not there (though they do error with ModuleNotFoundError
if pyembree
isn't installed).
Of course the functions I need were not in the standard library before Python 3.9... adding compatibility for Python 3.8 |
3c2c896
to
8c32a23
Compare
202e6b2
to
71d63ee
Compare
71d63ee
to
bb4c0ee
Compare
PR Summary
fix #4287
Turns out it was super easy, barely an inconvenience.