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

Remove a deprecated method from importlib_metadata #991

Merged

Conversation

DiddiLeija
Copy link
Contributor

@DiddiLeija DiddiLeija commented Jul 15, 2021

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.

The dict interface from "importlib_metadata" is deprecated, so it must not be used as well.
@DiddiLeija
Copy link
Contributor Author

I just have one question: where can I change the minimal required version of importlib_metadata?

@rahulporuri

This comment has been minimized.

That way, the deprecated feature removed won't be harmful.
Copy link
Contributor

@rahulporuri rahulporuri left a 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.

pyface/base_toolkit.py Outdated Show resolved Hide resolved
pyface/base_toolkit.py Outdated Show resolved Hide resolved
DiddiLeija and others added 2 commits July 15, 2021 20:19
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>
@DiddiLeija
Copy link
Contributor Author

Thanks @rahulporuri for your help. Now let's see if it worked.

pyface/__init__.py Outdated Show resolved Hide resolved
pyface/__init__.py Outdated Show resolved Hide resolved
this is because the select interface isn't available in
any of the prior python versions
Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Merging now.

@rahulporuri rahulporuri merged commit dc10108 into enthought:master Jul 16, 2021
@rahulporuri
Copy link
Contributor

Thanks for the contribution @DiddiLeija !

@DiddiLeija
Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Member

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.

@DiddiLeija DiddiLeija deleted the deprecation-from-importlib_metadata branch September 10, 2021 23:49
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.

Deprecation warning from "importlib_metadata"
3 participants