Skip to content

Replaced pkg_resources with importlib.metadata - #23

Open
idahogray wants to merge 1 commit into
to-mc:masterfrom
idahogray:replace-pkg-resources
Open

Replaced pkg_resources with importlib.metadata#23
idahogray wants to merge 1 commit into
to-mc:masterfrom
idahogray:replace-pkg-resources

Conversation

@idahogray

Copy link
Copy Markdown
Contributor

Use of pkg_resources is discouraged in favor of importlib.resources
and importlib.metadata. importlib.metadata is used in this commit
to get the version string from the pyproject.toml package configuration.

This PR closes #22 in order to hopefully allow PyOxidizer to package the library.

Use of pkg_resources is discouraged in favor of importlib.resources
and importlib.metadata. importlib.metadata is used in this commit
to get the version string from the pyproject.toml package configuration.
@stefan6419846

stefan6419846 commented Jun 6, 2023

Copy link
Copy Markdown

This will break compatibility in

python = "^3.6"

as importlib.metadata is only available since Python 3.8. Older Python versions (like supported by this project) require using the backport in importlib-metadata.

@stefan6419846

Copy link
Copy Markdown

As already mentioned, just requiring importlib_metadata; python_version < "3.8" (or dropping Python < 3.8 completely) and writing

try:
    from importlib.metadata import version
except ImportError:
    # Python < 3.8
    from importlib_metadata import version

would fix this for every supported version since Python 3.6.

@amirmasoudabdol

Copy link
Copy Markdown

This now issue a warning as follow, and if not addressed it can very well break the package in a few months.

site-packages/checksumdir/__init__.py:17: UserWarning: pkg_resources is deprecated as an API. 
See https://setuptools.pypa.io/en/latest/pkg_resources.html. 
The pkg_resources package is slated for removal as early as 2025-11-30. 
Refrain from using this package or pin to Setuptools<81.
  import pkg_resources

@amirmasoudabdol

Copy link
Copy Markdown

@to-mc, is there any way this being merged? 🙏🏼

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.

Replace pkg_resources

4 participants