MagicStack / MagicStack/asyncpg

setup.py relies on deprecated pkg_resources

未关闭
#1,337 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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:

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.py entirely to eliminate the pkg_resources dependency.
  • Port to packaging: alternatively the check can be preserved by switching to the packaging library, as the sister project uvloop did in MagicStack/uvloop@b377b7c6885a1eb63cb8cf19db5ab66a12c79e21 — replacing pkg_resources.Requirement.parse(...) with packaging.requirements.Requirement(...) and x not in dep with dep.specifier.contains(x, prereleases=True) (adding packaging to build-system.requires). pkg_resources.Requirement.__contains__ used prereleases=True internally, so passing prereleases=True preserves 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.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 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

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。