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

Use of pkg_resources is deprecated #28

Open
hosiet opened this issue Oct 24, 2024 · 1 comment
Open

Use of pkg_resources is deprecated #28

hosiet opened this issue Oct 24, 2024 · 1 comment

Comments

@hosiet
Copy link

hosiet commented Oct 24, 2024

When building the python wheel package, the following DeprecationWarning is emitted:

python3.12 -m build --skip-dependency-check --no-isolation --wheel
* Building wheel...
<string>:7: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

I see that setup.py imported pkg_resources. Please consider migrating away from it.

@musicinmybrain
Copy link

Just analyzing this a bit as someone who is packaging this for Fedora, and has worked on some related packages, but doesn’t regularly contribute to upstream development.

Here’s how pkg_resources is used:

openstep-plist/setup.py

Lines 26 to 32 in 61dc6ac

try:
required_cython = "cython >= %s" % cython_min_version
pkg_resources.require(required_cython)
except pkg_resources.ResolutionError:
with_cython = False
else:
with_cython = True

Directly replacing it without changing what it does is not straighforward: pypa/packaging-problems#317

On the other hand, there are many different styles of dealing with building Cython packages with or without regenerating sources; https://github.com/MagicStack/asyncpg/blob/v0.30.0/setup.py is an example of a different, perhaps somewhat fussy but effective approach.

This use of pkg_resources is only in a single spot setup.py, not in the library itself, so there probably doesn’t need to be a big hurry to replace it as long as setuptools still ships pkg_resources. If @anthrotype does settle on a different approach at some point, I assume they will want to make it consistent across all their Cython-based projects, e.g. https://github.com/googlefonts/compreffor/blob/0.5.6/setup.py and various others with similar snippets.

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