Install test: wheel_modules and wheel_names ignore <dist>.data/purelib and platlib, which pip installs into site-packages

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
build-system

調査の方向性

Start with wheel_modules() and wheel_names() in scripts/build_lab.py, whose list comprehension skips every top-level .data folder, and with the WheelModules tests in tests/test_gap_wheels.py. Add one shared helper that maps <name>.data/purelib/REST and <name>.data/platlib/REST to REST, and check native_libraries() and has_libs_folder() in scripts/gap_wheels.py. Done when the new layout tests pass, scripts/headers stay ignored, and uvx --python 3.14 [email protected] passes offline.

索引モデルが issue の本文から書いたものです。

説明

bug help wanted

The install test decides what to import from a wheel by reading its file names (wheel_modules() in scripts/build_lab.py), and decides whether a missing module is the wheel's own or a dependency's with wheel_names(). Both skip every top-level folder whose name ends in .data:

entries = [e for e in z.namelist() if not e.split("/", 1)[0].endswith((".dist-info", ".data"))]

But a wheel's <name>-<version>.data/purelib/ and .data/platlib/ folders are installed into site-packages, exactly like files at the wheel's root (the wheel spec's "data directory" section). A wheel that ships its package there looks empty to both helpers:

demo-1.0.data/platlib/demo/__init__.py
demo-1.0.data/platlib/demo/_speed.cpython-314-x86_64-linux-gnu.so
demo-1.0.dist-info/METADATA

wheel_modules() returns ([], [], 0): nothing to import and zero extension modules. The wheel's modules wouldn't be imported by the install test, or counted as the wheel's own when one is missing. #35 pinned today's behaviour in test_dist_info_and_data_folders_are_ignored_by_both and flagged it as wrong.

No published wheel is laid out this way today. Wheels built with some backends for some projects are, and the test that guards publishing shouldn't have a blind spot shaped like a wheel layout.

Where

scripts/build_lab.py: wheel_modules() and wheel_names(). Tests: WheelModules in tests/test_gap_wheels.py.

What to do

  • In both helpers, treat <anything>.data/purelib/REST and <anything>.data/platlib/REST as REST (strip the two leading parts), then apply the same rules as for root files. Other .data subfolders (scripts, headers, data) are not importable and stay ignored.
  • Share one small function for "the site-packages path of a wheel member, or None" between the two helpers, so they can't disagree.
  • native_libraries() and has_libs_folder() in scripts/gap_wheels.py read member names too. Check whether they need the same mapping and say what you found in the PR; change them only with a test.
  • This file is trusted pipeline code. Keep the change small and standard library only.

Done when:

  • Tests in WheelModules:
    • the layout above gives demo as a top module, demo._speed as an extension and a count of 1, from both platlib and purelib;
    • a wheel with the same module at the root and under platlib names it once;
    • demo-1.0.data/scripts/tool.py and demo-1.0.data/headers/x.h are still ignored;
    • wheel_names() lists the modules and packages under purelib/platlib.
  • test_dist_info_and_data_folders_are_ignored_by_both is updated to say what is still ignored.
  • In the PR, the one-line change that makes a new test fail.
  • uvx --python 3.14 [email protected] passes, offline.
主要言語
Python
スター
0
フォーク
1
平均マージ
5時間 59分
マージ済み PR(30日)
19

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

wheelgap/wheels のほかの issue

wheelgap/wheels の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。