-
Notifications
You must be signed in to change notification settings - Fork 12
[BIOINFSW-6193] Replace pkg_resources use with importlib metadata #151
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
Conversation
.github/workflows/pythonpackage.yml
Outdated
| test: | ||
|
|
||
| runs-on: ubuntu-20.04 | ||
| runs-on: ubuntu-latest |
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 can remove these newlines once we're done. I was just going cross-eyed with the yaml formatting since it is non-standard.
| try: | ||
| from importlib import metadata | ||
| except ImportError: # Python < 3.8 | ||
| try: | ||
| import importlib_metadata as metadata | ||
| except ImportError: | ||
| # Fall back to pkg_resources for Python < 3.8 if importlib_metadata not available | ||
| import pkg_resources | ||
| metadata = None |
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.
@scdunatun I didn't want to add an importlib_metadata dependency to stor.. so this is essentially backwards compatibility.
For python >=3.8 importlib will be installed and use that
For python <3.8 try using importlib_metadata (backport) if it is installed, otherwise use the fallback pkg_resources
Once we deprecate <3.10 we can remove all of this i favor of importlib
Ben-Habermeyer
left a comment
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. Should be backwards compatible for poor souls on 3.6/7 and fix deprecation warning for 3.8+.
We can make a story to release a new major version deprecating these old versions and modernizing the ci
Description
pkg_resourcesis being deprecated and all applications that install stor are unable to upgrade the setuptools version due to its use ofpkg_resources. Instead ofpkg_resources, we should useimportlib'smetadata.Changes
pkg_resourcestoimportlib'smetadatain__init__.py. Fall back import and use for older version of python.ubuntu-22.04runners with updated action version tags.Testing