Skip to content

Migrate away from pkg_resources #1935

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

Merged
merged 2 commits into from
Jan 20, 2024
Merged

Conversation

tacerus
Copy link
Contributor

@tacerus tacerus commented Jan 12, 2024

Using pkg_resources as an API is deprecated.
Migrate functionality to their importlib and packaging equivalents.

Using pkg_resources as an API is deprecated.
Migrate functionality to their importlib and packaging equivalents.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Required for packaging.version after the removal of pkg_resources.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
@cclauss cclauss requested review from acdha and claudep January 18, 2024 06:02
@cclauss cclauss merged commit 3bc1d4e into django-haystack:master Jan 20, 2024
@cclauss
Copy link
Contributor

cclauss commented Jan 20, 2024

This is needed because of the following error...
% python3.12 -m pip install django-haystack
% python3.12
>>> import haystack

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/haystack/__init__.py", line 4, in <module>
    from pkg_resources import DistributionNotFound, get_distribution, parse_version
ModuleNotFoundError: No module named 'pkg_resources'

https://docs.python.org/3/whatsnew/3.12.html#ensurepip

@tacerus
Copy link
Contributor Author

tacerus commented Jan 20, 2024

In our case it was needed to an update in flufl-lock, which broke several Python modules. Quite a story:
https://progress.opensuse.org/issues/153199

(Thanks for merging!)

@tacerus tacerus deleted the importlib branch January 20, 2024 18:42
@cclauss
Copy link
Contributor

cclauss commented Jan 20, 2024

From the Py3.12 URL above I see that they recommend pip install setuptools instead of pip install packaging but for the build tools for Node.js add-ons we had to vendor in packaging so I know that it works.

dwasyl pushed a commit to dwasyl/django-haystack that referenced this pull request Apr 28, 2025
* Migrate away from pkg_resources

Using pkg_resources as an API is deprecated.
Migrate functionality to their importlib and packaging equivalents.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>

* Add packaging to requirements

Required for packaging.version after the removal of pkg_resources.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>

---------

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants