refactor(wheels): propagate wheels via PyWheelInfo instead of DefaultInfo#912
refactor(wheels): propagate wheels via PyWheelInfo instead of DefaultInfo#912
Conversation
|
My questions... After #907 does this still have an effect? .... PR #907 is complementary but addresses a different artifact: it removes install_dir (the unpacked wheel directory) from whl_install's DefaultInfo.files. Our change removes raw .whl files from DefaultInfo by eliminating whl_lib. However, PR #907 alone doesn't fully solve either problem. install_dir was removed from whl_install's own DefaultInfo.files, but py_library still propagated it further — because py_library.DefaultInfo.files included transitive = So after PR #907 merges, our change still has positive effects:
The two changes together clean up both sides: PR #907 removes install dirs, our change removes wheel archives and the mode-switching machinery that existed to surface them. |
6957ccd to
e50983b
Compare
|
|
Me talking to robots...
⏺ PyWheelInfo was defined but never wired up to actually carry wheel files through the graph. The original design used a different mechanism entirely:
So there was no need for a provider — the mode transition was doing the selection work, and DefaultInfo was the transport. PyWheelInfo was defined in providers.bzl but nobody ever set it with wheel files, so it was dead code. Our change inverts this: whl_install now populates PyWheelInfo.files with the archive, py_library propagates it transitively, and whl_requirements reads it directly — no transition needed. |
e50983b to
2d3443e
Compare
…Info Previously, wheel files leaked into DefaultInfo.files of every target that transitively depended on a pip package. This happened because whl_requirements used whl_mode_transition to flip lib_mode=whl across the dep graph, causing install aliases to resolve to whl_lib (a py_library with the raw .whl file as srcs). Since py_library propagates DefaultInfo.files transitively, every intermediate target accumulated all transitive .whl files as visible build outputs. The fix introduces PyWheelInfo, a dedicated provider that carries wheel files without putting them in DefaultInfo: - whl_install now returns PyWheelInfo(files=depset([archive])) alongside its existing DefaultInfo and PyInfo - py_library propagates PyWheelInfo transitively from its deps, so the full set of transitive wheels is reachable from any node in the dep graph - whl_requirements reads PyWheelInfo.files directly, with no cfg transition Because whl_requirements no longer needs whl_mode_transition to surface wheels, the entire lib_mode machinery becomes unnecessary: - whl_mode_transition was only used by whl_requirements (now gone) and py_whl_library (which only existed to force whl mode) - lib_mode_transition on pep517_whl existed solely to counteract whl_mode_transition in source-build dep chains; without whl_mode_transition there is nothing to counteract - whl_lib in each package repo and the libs_are_whls arm of the install select are removed; install always resolves to actual_install - py_whl_library in the hub becomes a plain alias; PyWheelInfo is available on the same target without any mode transition libs_are_libs and libs_are_whls config_settings are retained as no-op stubs for API compatibility. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2d3443e to
9f652c8
Compare

This was a robots work to "stop propagating all the wheels via DefaultInfo" which @dzbarsky mentioned on slack.
--
Previously, wheel files leaked into DefaultInfo.files of every target that transitively depended on a pip package. This happened because whl_requirements used whl_mode_transition to flip lib_mode=whl across the dep graph, causing install aliases to resolve to whl_lib (a py_library with the raw .whl file as srcs). Since py_library propagates DefaultInfo.files transitively, every intermediate target accumulated all transitive .whl files as visible build outputs.
The fix introduces PyWheelInfo, a dedicated provider that carries wheel files without putting them in DefaultInfo:
Because whl_requirements no longer needs whl_mode_transition to surface wheels, the entire lib_mode machinery becomes unnecessary:
libs_are_libs and libs_are_whls config_settings are retained as no-op stubs for API compatibility.
Changes are visible to end-users: yes/no
Test plan