Skip to content

Commit 8719187

Browse files
mmccartylowener
authored andcommitted
wheel builds: react to changes in pip's handling of build constraints (rapidsai#1710)
Contributes to rapidsai/build-planning#242 Modifying `ci/build_wheel.sh` to - pass`--build-constraint="${PIP_CONSTRAINT}"` unless build isolation is enabled. - unset `PIP_CONSTRAINT` (set by rapids-init-pip)... it doesn't affect builds as of pip 25.3, and results in an error from `pip wheel` when set and `--build-constraint` is also passed Authors: - Mike McCarty (https://github.com/mmccarty) Approvers: - James Lamb (https://github.com/jameslamb) URL: rapidsai#1710
1 parent 2df9471 commit 8719187

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

ci/build_wheel.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION.
2+
# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION.
33
# SPDX-License-Identifier: Apache-2.0
44

55
set -euo pipefail
@@ -47,11 +47,26 @@ rapids-logger "Building '${package_name}' wheel"
4747

4848
sccache --stop-server 2>/dev/null || true
4949

50+
RAPIDS_PIP_WHEEL_ARGS=(
51+
-w dist
52+
-v
53+
--no-deps
54+
--disable-pip-version-check
55+
)
56+
# Only use --build-constraint when build isolation is enabled.
57+
#
58+
# Passing '--build-constraint' and '--no-build-isolation` together results in an error from 'pip',
59+
# but we want to keep environment variable PIP_CONSTRAINT set unconditionally.
60+
# PIP_NO_BUILD_ISOLATION=0 means "add --no-build-isolation" (ref: https://github.com/pypa/pip/issues/573
61+
if [[ "${PIP_NO_BUILD_ISOLATION:-}" != "0" ]]; then
62+
RAPIDS_PIP_WHEEL_ARGS+=(--build-constraint="${PIP_CONSTRAINT}")
63+
fi
64+
65+
# unset PIP_CONSTRAINT (set by rapids-init-pip)... it doesn't affect builds as of pip 25.3, and
66+
# results in an error from 'pip wheel' when set and --build-constraint is also passed
67+
unset PIP_CONSTRAINT
5068
rapids-pip-retry wheel \
51-
-w dist \
52-
-v \
53-
--no-deps \
54-
--disable-pip-version-check \
69+
"${RAPIDS_PIP_WHEEL_ARGS[@]}" \
5570
.
5671

5772
sccache --show-adv-stats

ci/build_wheel_cuvs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION.
2+
# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION.
33
# SPDX-License-Identifier: Apache-2.0
44

55
set -euo pipefail
@@ -13,8 +13,8 @@ RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}")"
1313
# Downloads libcuvs wheels from this current build,
1414
# then ensures 'cuvs' wheel builds always use the 'libcuvs' just built in the same CI run.
1515
#
16-
# Using env variable PIP_CONSTRAINT is necessary to ensure the constraints
17-
# Using env variable PIP_CONSTRAINT (initialized by 'rapids-init-pip') is necessary to ensure the constraints
16+
# env variable 'PIP_CONSTRAINT' is set up by rapids-init-pip. It constrains all subsequent
17+
# 'pip install', 'pip download', etc. calls (except those used in 'pip wheel', handled separately in build scripts)
1818
LIBCUVS_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="libcuvs_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-github cpp)
1919
echo "libcuvs-${RAPIDS_PY_CUDA_SUFFIX} @ file://$(echo "${LIBCUVS_WHEELHOUSE}"/libcuvs_*.whl)" >> "${PIP_CONSTRAINT}"
2020

0 commit comments

Comments
 (0)