setup.py relies on deprecated pkg_resources
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 28/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- build-system
Research direction
Start by reading setup.py around lines 191 and 204-205, then compare the existing PR #1314 with the packaging approach used by uvloop. Done means the source-build path no longer imports deprecated pkg_resources while preserving the intended Cython dependency behavior.
Written by the indexing model from the issue text.
Description
Summary
setup.py imports and uses the deprecated pkg_resources module (from setuptools) to validate the installed Cython version when building asyncpg from source:
- https://github.com/MagicStack/asyncpg/blob/db8ecc2/setup.py#L191
- https://github.com/MagicStack/asyncpg/blob/db8ecc2/setup.py#L204-L205
import pkg_resources
...
cython_dep = pkg_resources.Requirement.parse(CYTHON_DEPENDENCY)
if Cython.__version__ not in cython_dep:
...
Problem
pkg_resources has long been deprecated by setuptools: importing it emits DeprecationWarning: pkg_resources is deprecated as an API, and it is slated for removal. On recent setuptools/distro configurations it may no longer be importable at all, which can make source builds of asyncpg warn or fail.
Existing work / options
- Drop the check: open PR #1314 already proposes removing the Cython version check from
setup.pyentirely to eliminate thepkg_resourcesdependency. - Port to
packaging: alternatively the check can be preserved by switching to thepackaginglibrary, as the sister project uvloop did in MagicStack/uvloop@b377b7c6885a1eb63cb8cf19db5ab66a12c79e21 — replacingpkg_resources.Requirement.parse(...)withpackaging.requirements.Requirement(...)andx not in depwithdep.specifier.contains(x, prereleases=True)(addingpackagingtobuild-system.requires).pkg_resources.Requirement.__contains__usedprereleases=Trueinternally, so passingprereleases=Truepreserves the original behavior exactly.
Either approach removes the deprecated dependency. Filing this to track the deprecation as an issue alongside the in-flight PR #1314.
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 469
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 9
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MagicStack/asyncpg
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MagicStack/asyncpg#1357 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
MagicStack/asyncpg#1354 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
MagicStack/asyncpg#1342 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 56/100
MagicStack/asyncpg#1340 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
MagicStack/asyncpg#1330 · 1 comment ·
All issues in MagicStack/asyncpg
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·