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 deprecated pkg_resources import #981

Closed
adrinjalali opened this issue Jun 12, 2023 · 1 comment
Closed

Remove deprecated pkg_resources import #981

adrinjalali opened this issue Jun 12, 2023 · 1 comment

Comments

@adrinjalali
Copy link

pkg_resources is deprecated as an API. I think the alternative is to use packaging.version.

The import occurs here:

import pkg_resources
from pkg_resources import parse_version

And it makes CIs fail if they raise on deprecation warnings. Eg: https://github.com/fairlearn/fairlearn/actions/runs/5242050040/jobs/9464954323?pr=1241

In scikit-learn we vendor packaging instead of having it as a dependency, but it's a very lightweight dependency.

ottonemo added a commit that referenced this issue Jun 13, 2023
The `pkg_resources` module is deprecated and mostly superseded
by `importlib`. To find the torch version we don't actually need
to check the metadata, as torch also provides the `__version__`
attribute which can be checked directly.

Therefore, `importlib.metadata.version` is only needed to fetch
the currently installed skorch version as a drop-in replacement
for `pkg_resources.distribution('skorch').version`.
@ottonemo
Copy link
Member

Thanks for reporting. I just made a PR to address this issue.

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

No branches or pull requests

2 participants