Skip to content

fix: replace pkg_resources with packaging for setuptools 82+#737

Open
junagent wants to merge 1 commit intoMagicStack:masterfrom
junagent:fix/replace-pkg-resources-with-importlib
Open

fix: replace pkg_resources with packaging for setuptools 82+#737
junagent wants to merge 1 commit intoMagicStack:masterfrom
junagent:fix/replace-pkg-resources-with-importlib

Conversation

@junagent
Copy link

Summary

pkg_resources was removed from setuptools 82.0.0 (PEP 740, Feb 2026). This breaks uvloop installation when built from source with the latest setuptools.

Fix

Replace pkg_resources.Requirement.parse() with the stdlib packaging.requirements.Requirement (available since Python 3.8):

  • Removed: import pkg_resources
  • Removed: pkg_resources.Requirement.parse(CYTHON_DEPENDENCY)
  • Added: from packaging.requirements import Requirement
  • Added: Requirement(CYTHON_DEPENDENCY)

The version comparison is updated to use specifier string comparison.

Testing

pip install setuptools>=82
pip install uvloop # should work without pkg_resources error
python -c "import uvloop"

Fixes MagicStack/uvloop issue about pkg_resources removal in setuptools 82+
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.

1 participant