MagicStack / MagicStack/asyncpg

setup.py relies on deprecated pkg_resources

オープン
#1,337 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。