Skip to content

Replace deprecated pkg_resources with importlib.metadata#8

Open
NGeorgescu wants to merge 1 commit into
BreadMakesYouFull:mainfrom
NGeorgescu:fix-pkg-resources
Open

Replace deprecated pkg_resources with importlib.metadata#8
NGeorgescu wants to merge 1 commit into
BreadMakesYouFull:mainfrom
NGeorgescu:fix-pkg-resources

Conversation

@NGeorgescu
Copy link
Copy Markdown

Summary

baseconvert/__init__.py imports pkg_resources to read the package version. pkg_resources is part of the legacy setuptools distribution and is no longer installed by default in many modern Python environments (notably Python 3.12+ on several distros and virtualenvs), so simply doing import baseconvert fails with:

ModuleNotFoundError: No module named 'pkg_resources'

This PR switches to importlib.metadata.version, which has been part of the standard library since Python 3.8 and is the officially recommended replacement (pkg_resources is deprecated upstream).

Test plan

  • python -c "import baseconvert; print(baseconvert.__version__)" works on Python 3.14 without setuptools installed
  • No behavior change for environments that previously worked

pkg_resources was removed from setuptools' default install in recent
versions and is unavailable on Python 3.12+ in many environments,
causing 'ModuleNotFoundError: No module named pkg_resources' on import.
importlib.metadata is part of the standard library since Python 3.8 and
is the recommended replacement.
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.

2 participants