Skip to content

Commit e8d9075

Browse files
authored
build: switch to uv as build frontend (#2964)
ci: switch cibuildwheel to uv and drop dummy wheel tests Use build[uv] with UV_* constraints. Dump sccache during Linux repair instead of installing each wheel only to echo ok.
1 parent e593284 commit e8d9075

3 files changed

Lines changed: 36 additions & 46 deletions

File tree

‎.github/workflows/build-wheel.yml‎

Lines changed: 36 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,18 @@ jobs:
227227
with:
228228
package-dir: ./cuda_bindings/
229229
output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
230+
extras: uv
230231
env:
231232
CIBW_BUILD: ${{ env.CIBW_BUILD }}
232-
CIBW_BEFORE_BUILD_LINUX: 'python -m pip install --upgrade "pip>=25.3"'
233-
CIBW_BEFORE_BUILD_WINDOWS: 'python -m pip install --upgrade "pip>=25.3" delvewheel'
233+
# build[uv]: same PEP 517 orchestration, with uv instead of pip.
234+
# extras: uv puts uv on PATH (required on Windows).
235+
CIBW_BUILD_FRONTEND: "build[uv]"
234236
# CIBW mounts the host filesystem under /host
235237
CIBW_ENVIRONMENT_LINUX: >
236238
CUDA_PATH=/host/${{ env.CUDA_PATH }}
237239
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
238-
PIP_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-bindings.txt
239-
PIP_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-bindings.txt
240+
UV_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-bindings.txt
241+
UV_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-bindings.txt
240242
CC="/host/${{ env.SCCACHE_PATH }} cc"
241243
CXX="/host/${{ env.SCCACHE_PATH }} c++"
242244
SCCACHE_GHA_ENABLED=true
@@ -248,17 +250,13 @@ jobs:
248250
CIBW_ENVIRONMENT_WINDOWS: >
249251
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
250252
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
251-
PIP_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-bindings.txt)"
252-
PIP_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-bindings.txt)"
253-
# check cache stats before leaving cibuildwheel
254-
CIBW_BEFORE_TEST_LINUX: >
253+
UV_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-bindings.txt)"
254+
UV_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-bindings.txt)"
255+
# Dump sccache stats during repair; no dummy test stage.
256+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
255257
"/host/${{ env.SCCACHE_PATH }}" --show-adv-stats &&
256-
"/host/${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_bindings.json
257-
# force the test stage to be run (so that before-test is not skipped)
258-
# TODO: we might want to think twice on adding this, it does a lot of
259-
# things before reaching this command.
260-
CIBW_TEST_COMMAND: >
261-
echo "ok!"
258+
"/host/${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_bindings.json &&
259+
auditwheel repair -w {dest_dir} {wheel}
262260
263261
- name: Report sccache stats (cuda.bindings)
264262
if: ${{ env.BUILD_BINDINGS == 'true' && !startsWith(inputs.host-platform, 'win') }}
@@ -327,17 +325,18 @@ jobs:
327325
with:
328326
package-dir: ./cuda_core/
329327
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
328+
extras: uv
330329
env:
331330
CIBW_BUILD: ${{ env.CIBW_BUILD }}
332-
CIBW_BEFORE_BUILD_LINUX: 'python -m pip install --upgrade "pip>=25.3"'
333-
CIBW_BEFORE_BUILD_WINDOWS: 'python -m pip install --upgrade "pip>=25.3" delvewheel'
331+
# See the cuda.bindings step above for UV_* vs PIP_*.
332+
CIBW_BUILD_FRONTEND: "build[uv]"
334333
# CIBW mounts the host filesystem under /host
335334
CIBW_ENVIRONMENT_LINUX: >
336335
CUDA_PATH=/host/${{ env.CUDA_PATH }}
337336
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
338337
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }}
339-
PIP_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core.txt
340-
PIP_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core.txt
338+
UV_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core.txt
339+
UV_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core.txt
341340
CC="/host/${{ env.SCCACHE_PATH }} cc"
342341
CXX="/host/${{ env.SCCACHE_PATH }} c++"
343342
SCCACHE_GHA_ENABLED=true
@@ -350,17 +349,13 @@ jobs:
350349
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
351350
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
352351
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }}
353-
PIP_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core.txt)"
354-
PIP_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core.txt)"
355-
# check cache stats before leaving cibuildwheel
356-
CIBW_BEFORE_TEST_LINUX: >
357-
"/host${{ env.SCCACHE_PATH }}" --show-adv-stats &&
358-
"/host${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core.json
359-
# force the test stage to be run (so that before-test is not skipped)
360-
# TODO: we might want to think twice on adding this, it does a lot of
361-
# things before reaching this command.
362-
CIBW_TEST_COMMAND: >
363-
echo "ok!"
352+
UV_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core.txt)"
353+
UV_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core.txt)"
354+
# Dump sccache stats during repair; no dummy test stage.
355+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
356+
"/host/${{ env.SCCACHE_PATH }}" --show-adv-stats &&
357+
"/host/${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core.json &&
358+
auditwheel repair -w {dest_dir} {wheel}
364359
365360
- name: Report sccache stats (cuda.core)
366361
if: ${{ env.BUILD_CORE == 'true' && !startsWith(inputs.host-platform, 'win') }}
@@ -614,17 +609,18 @@ jobs:
614609
with:
615610
package-dir: ./cuda_core/
616611
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
612+
extras: uv
617613
env:
618614
CIBW_BUILD: ${{ env.CIBW_BUILD }}
619-
CIBW_BEFORE_BUILD_LINUX: 'python -m pip install --upgrade "pip>=25.3"'
620-
CIBW_BEFORE_BUILD_WINDOWS: 'python -m pip install --upgrade "pip>=25.3" delvewheel'
615+
# See the cuda.bindings step above for UV_* vs PIP_*.
616+
CIBW_BUILD_FRONTEND: "build[uv]"
621617
# CIBW mounts the host filesystem under /host
622618
CIBW_ENVIRONMENT_LINUX: >
623619
CUDA_PATH=/host/${{ env.CUDA_PATH }}
624620
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
625621
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }}
626-
PIP_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core-prev.txt
627-
PIP_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core-prev.txt
622+
UV_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core-prev.txt
623+
UV_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core-prev.txt
628624
CC="/host/${{ env.SCCACHE_PATH }} cc"
629625
CXX="/host/${{ env.SCCACHE_PATH }} c++"
630626
SCCACHE_GHA_ENABLED=true
@@ -637,17 +633,13 @@ jobs:
637633
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
638634
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
639635
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }}
640-
PIP_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core-prev.txt)"
641-
PIP_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core-prev.txt)"
642-
# check cache stats before leaving cibuildwheel
643-
CIBW_BEFORE_TEST_LINUX: >
644-
"/host${{ env.SCCACHE_PATH }}" --show-adv-stats &&
645-
"/host${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core_prev.json
646-
# force the test stage to be run (so that before-test is not skipped)
647-
# TODO: we might want to think twice on adding this, it does a lot of
648-
# things before reaching this command.
649-
CIBW_TEST_COMMAND: >
650-
echo "ok!"
636+
UV_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core-prev.txt)"
637+
UV_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core-prev.txt)"
638+
# Dump sccache stats during repair; no dummy test stage.
639+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
640+
"/host/${{ env.SCCACHE_PATH }}" --show-adv-stats &&
641+
"/host/${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core_prev.json &&
642+
auditwheel repair -w {dest_dir} {wheel}
651643
652644
- name: Report sccache stats (cuda.core prev)
653645
if: ${{ !inputs.single-cuda-major && env.BUILD_CORE == 'true' && !startsWith(inputs.host-platform, 'win') }}

‎cuda_bindings/pyproject.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ build-verbosity = 1
8585
archs = "native"
8686

8787
[tool.cibuildwheel.windows]
88-
before-build = "pip install delvewheel"
8988
repair-wheel-command = "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wheel}"
9089

9190
[tool.pytest.ini_options]

‎cuda_core/pyproject.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,4 @@ build-verbosity = 1
152152
archs = "native"
153153

154154
[tool.cibuildwheel.windows]
155-
before-build = "pip install delvewheel"
156155
repair-wheel-command = "delvewheel repair --namespace-pkg cuda --exclude \"torch_cpu.dll;torch_python.dll\" -w {dest_dir} {wheel}"

0 commit comments

Comments
 (0)