Skip to content

Conversation

@scdunatun
Copy link
Contributor

@scdunatun scdunatun commented Dec 30, 2025

Description

pkg_resources is being deprecated and all applications that install stor are unable to upgrade the setuptools version due to its use of pkg_resources. Instead of pkg_resources, we should use importlib's metadata.

Changes

  • Updated use of pkg_resources to importlib's metadata in __init__.py. Fall back import and use for older version of python.
  • Updated CI/CD to run on ubuntu-22.04 runners with updated action version tags.

Testing

  • CI/CD successful for python 3.7 and 3.8.

test:

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
Copy link
Contributor Author

@scdunatun scdunatun Dec 30, 2025

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.

Comment on lines 23 to 31
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
Copy link
Contributor

@Ben-Habermeyer Ben-Habermeyer Dec 30, 2025

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 Ben-Habermeyer marked this pull request as ready for review December 30, 2025 23:41
Copy link
Contributor

@Ben-Habermeyer Ben-Habermeyer left a 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

@scdunatun scdunatun merged commit 9821ad8 into master Dec 30, 2025
2 checks passed
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.

3 participants