-
Notifications
You must be signed in to change notification settings - Fork 55
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
Remove a deprecated method from importlib_metadata
#991
Remove a deprecated method from importlib_metadata
#991
Conversation
The dict interface from "importlib_metadata" is deprecated, so it must not be used as well.
I just have one question: where can I change the minimal required version of |
This comment has been minimized.
This comment has been minimized.
That way, the deprecated feature removed won't be harmful.
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.
TypeError: select() takes 1 positional argument but 2 were given
The above is the error from the CI jobs. It looks like you can't pass entry_point
as a positional argument. You will need to explicitly pass it as a keyword argument instead.
Convert a positional argument from "importlib_metadata.entry_points().select()" into a keyword argument. Co-authored-by: Poruri Sai Rahul <rahul.poruri@gmail.com>
Convert a positional argument from "importlib_metadata.entry_points().select()" into a keyword argument. Co-authored-by: Poruri Sai Rahul <rahul.poruri@gmail.com>
Thanks @rahulporuri for your help. Now let's see if it worked. |
the select interface was introduced in 3.6.0. ref https://importlib-metadata.readthedocs.io/en/latest/history.html#v3-6-0
this is because the select interface isn't available in any of the prior python versions
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. Merging now.
Thanks for the contribution @DiddiLeija ! |
Thanks @rahulporuri for merging and reviewing! |
@@ -187,7 +187,7 @@ def import_toolkit(toolkit_name, entry_point="pyface.toolkits"): | |||
If no toolkit is found, or if the toolkit cannot be loaded for some | |||
reason. | |||
""" | |||
entry_point_group = importlib_metadata.entry_points()[entry_point] | |||
entry_point_group = importlib_metadata.entry_points().select(group=entry_point) |
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.
Unfortunately, this code fails on newer Python versions, where import importlib.metadata as importlib_metadata
is used: the return value from entry_points()
is then a plain dict, which doesn't have a select
method.
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.
I've opened #998 to track this. It might also be good to see if we can get the CI tests running on Python 3.9, so that this sort of failure is detected earlier.
Fixes #952. It removes a deprecated feature from importlib_metadata. See the reference here: https://importlib-metadata.readthedocs.io/en/latest/history.html#v3-9-0.