ci: constrain internal builds to exact local wheels - #2510
Open
rwgk wants to merge 1 commit into
Open
Conversation
Contributor
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #2468.
xref: #2464, #2470
Same-checkout CI builds must not silently substitute a compatible package from PyPI for the local CUDA Python wheel that the workflow intends to test. This PR makes that invariant explicit: once CI selects a local internal wheel, pip must consume that exact artifact or fail. Public package indexes remain available for third-party dependencies. See #2468 for the failure history and detailed analysis.
This PR is stacked on #2509. The base PR reports the version and location of the dependencies imported by the build hooks; this PR enforces which artifacts pip selects.
The selection policy remains entirely in CI. Normal package build requirements are unchanged, and builds that do not supply these constraints retain their existing behavior.
Exact local-wheel constraints
This PR adds
ci/tools/write_wheel_constraints.py, a small cross-platform helper that turns selected wheel artifacts into PEP 508 direct-reference constraints such as:The helper:
.dist-info/METADATAinstead of trusting its filename;/hostmount when needed;Each protected build supplies both
PIP_BUILD_CONSTRAINTandPIP_CONSTRAINT. The former constrains dependencies installed into PEP 517 isolated build environments; the latter applies the same selection to other pip dependency resolution in the step. The affected environments install pip 25.3 or newer, where dedicated build constraints are supported.This replaces artifact selection based on
PIP_FIND_LINKSandPIP_PREin these workflows. Those settings can make a local wheel discoverable or make a prerelease eligible, but they do not identify the exact artifact that must be tested.Protected dependency edges
cuda.bindingscuda-pathfinderwheelcuda.corecuda-pathfinderand current-majorcuda-bindingswheelscuda.corecuda-pathfinderand previous-majorcuda-bindingswheelsThe constraints are applied across:
cuda.corebuild;The downloaded previous-major bindings wheel is kept in a separate directory from the current build artifacts. This makes major selection explicit and avoids an ambiguous wheel directory before generating the previous-major core constraint.
Tests
The new helper has unit coverage for successful direct-reference generation, project-name canonicalization, expected-major selection, paths containing spaces, cibuildwheel container-path mapping, and diagnostic output. Failure coverage includes missing or empty directories, wrong distributions or majors, multiple matching wheels, invalid project names, corrupt archives, malformed metadata, duplicate requests, invalid container mounts, and stale-output removal.
The standalone CI-tool tests are now run by the existing pre-commit CI job without importing the repository-level test configuration.