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

Aperta
#38 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
build-system

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Python
Stelle
0
Fork
1
Merge medio
5h 59m
PR unite (30g)
19

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wheelgap/wheels

Tutte le issue di wheelgap/wheels

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.