MagicStack / MagicStack/asyncpg
setup.py relies on deprecated pkg_resources
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 468
- PR 合并指标
- 30 天内没有已合并 PR
描述
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.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读第 191 行和第 204-205 行附近的 setup.py,然后将现有的 PR #1314 与 uvloop 使用的打包方式进行比较。完成的标准是源代码构建路径不再导入 pkg_resources,同时保留预期的 Cython 依赖行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- build-system
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 28/100