Skip to content

Commit 82bc3c9

Browse files
kkraus14cursoragent
andcommitted
Switch to uv build frontend and add top-level uv workspace
- Add root pyproject.toml as virtual uv workspace covering cuda_bindings, cuda_core, cuda_pathfinder, cuda_python, and cuda_python_test_helpers. - Declare workspace-level cu12/cu13 conflicts so uv lock can resolve the mutually-exclusive cuda-toolkit version requirements. - Add [tool.cibuildwheel] build-frontend = "build[uv]" to cuda_bindings and cuda_core. - Add [tool.uv.sources] workspace references to cuda_bindings and cuda_core so transitive workspace deps resolve during lock. - Add cuda-pathfinder to cuda_core build-system.requires so uv sees the transitive build dependency chain. - Make cuda_python dependencies static in pyproject.toml. - Replace pip with uv across all CI workflows (build-wheel, test-wheel-linux, test-wheel-windows, build-docs, coverage) and ci/tools/run-tests. - Install uv via astral-sh/setup-uv@v5 in every workflow. - Use uv build --wheel, uv pip install, and uv sync --only-group for dependency group installation. - Exclude uv.lock from SPDX and large-file pre-commit checks. - Generate uv.lock for the workspace. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 3e022ad commit 82bc3c9

13 files changed

Lines changed: 3479 additions & 75 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ cuda_core/cuda/core/_cpp/*.hpp -binary text diff
1414
*.svg binary
1515
# SCM syntax highlighting & preventing 3-way merges
1616
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
17+
uv.lock merge=binary linguist-language=TOML linguist-generated=true
1718

1819
# "export-subst" specifies that this file will get filled in with the current
1920
# commit and tag information when running `git archive`. This allows

.github/workflows/build-docs.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -77,6 +77,9 @@ jobs:
7777
conda config --show-sources
7878
conda config --show
7979
80+
- name: Install uv
81+
uses: astral-sh/setup-uv@v5
82+
8083
# WAR: Building the doc currently requires CTK installed (NVIDIA/cuda-python#326,327)
8184
- name: Set up mini CTK
8285
uses: ./.github/actions/fetch_ctk
@@ -181,18 +184,18 @@ jobs:
181184
- name: Install all packages
182185
run: |
183186
pushd cuda_pathfinder
184-
pip install *.whl
187+
uv pip install *.whl
185188
popd
186189
187190
pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}"
188-
pip install *.whl
191+
uv pip install *.whl
189192
popd
190193
191194
pushd "${CUDA_CORE_ARTIFACTS_DIR}"
192-
pip install *.whl
195+
uv pip install *.whl
193196
popd
194197
195-
pip install cuda_python*.whl
198+
uv pip install cuda_python*.whl
196199
197200
# This step sets the PR_NUMBER/BUILD_LATEST/BUILD_PREVIEW env vars.
198201
- name: Get PR number

.github/workflows/build-wheel.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,18 @@ jobs:
106106
run: |
107107
env
108108
109+
- name: Install uv
110+
uses: astral-sh/setup-uv@v5
111+
109112
- name: Install twine
110113
run: |
111-
pip install twine
114+
uv pip install twine
112115
113116
# To keep the build workflow simple, all matrix jobs will build a wheel for later use within this workflow.
114117
- name: Build and check cuda.pathfinder wheel
115118
run: |
116119
pushd cuda_pathfinder
117-
pip wheel -v --no-deps .
120+
uv build --wheel
118121
popd
119122
120123
- name: List the cuda.pathfinder artifacts directory
@@ -124,22 +127,22 @@ jobs:
124127
else
125128
export CHOWN="sudo chown"
126129
fi
127-
$CHOWN -R $(whoami) cuda_pathfinder/*.whl
128-
ls -lahR cuda_pathfinder
130+
$CHOWN -R $(whoami) cuda_pathfinder/dist/*.whl
131+
ls -lahR cuda_pathfinder/dist
129132
130133
# We only need/want a single pure python wheel, pick linux-64 index 0.
131134
# This is what we will use for testing & releasing.
132135
- name: Check cuda.pathfinder wheel
133136
if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }}
134137
run: |
135-
twine check --strict cuda_pathfinder/*.whl
138+
twine check --strict cuda_pathfinder/dist/*.whl
136139
137140
- name: Upload cuda.pathfinder build artifacts
138141
if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }}
139142
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
140143
with:
141144
name: cuda-pathfinder-wheel
142-
path: cuda_pathfinder/*.whl
145+
path: cuda_pathfinder/dist/*.whl
143146
if-no-files-found: error
144147

145148
- name: Set up mini CTK
@@ -267,8 +270,8 @@ jobs:
267270
if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }}
268271
run: |
269272
pushd cuda_python
270-
pip wheel -v --no-deps .
271-
twine check --strict *.whl
273+
uv build --wheel
274+
twine check --strict dist/*.whl
272275
popd
273276
274277
- name: List the cuda-python artifacts directory
@@ -279,15 +282,15 @@ jobs:
279282
else
280283
export CHOWN="sudo chown"
281284
fi
282-
$CHOWN -R $(whoami) cuda_python/*.whl
283-
ls -lahR cuda_python
285+
$CHOWN -R $(whoami) cuda_python/dist/*.whl
286+
ls -lahR cuda_python/dist
284287
285288
- name: Upload cuda-python build artifacts
286289
if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }}
287290
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
288291
with:
289292
name: cuda-python-wheel
290-
path: cuda_python/*.whl
293+
path: cuda_python/dist/*.whl
291294
if-no-files-found: error
292295

293296
- name: Set up Python
@@ -312,11 +315,12 @@ jobs:
312315
313316
- name: Install cuda.pathfinder (required for next step)
314317
run: |
315-
pip install cuda_pathfinder/*.whl
318+
uv pip install cuda_pathfinder/dist/*.whl
316319
317320
- name: Build cuda.bindings Cython tests
318321
run: |
319-
pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings/pyproject.toml:test
322+
uv pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl
323+
uv pip install "pytest>=6.2.4" "pytest-benchmark>=3.4.1" pytest-randomly pytest-repeat "pyglet>=2.1.9" "numpy>=1.21.1" "cython>=3.2,<3.3" "setuptools>=77.0.0"
320324
pushd ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}
321325
bash build_tests.sh
322326
popd
@@ -330,7 +334,8 @@ jobs:
330334

331335
- name: Build cuda.core Cython tests
332336
run: |
333-
pip install ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/"cu${BUILD_CUDA_MAJOR}"/*.whl --group ./cuda_core/pyproject.toml:test
337+
uv pip install ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/"cu${BUILD_CUDA_MAJOR}"/*.whl
338+
uv pip install "pytest>=6.2.4" pytest-randomly pytest-repeat "cython>=3.2,<3.3" setuptools
334339
pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}
335340
bash build_tests.sh
336341
popd
@@ -444,7 +449,7 @@ jobs:
444449
445450
- name: Merge cuda.core wheels
446451
run: |
447-
pip install wheel
452+
uv pip install wheel
448453
python ci/tools/merge_cuda_core_wheels.py \
449454
"${{ env.CUDA_CORE_ARTIFACTS_DIR }}"/cu"${BUILD_CUDA_MAJOR}"/cuda_core*.whl \
450455
"${{ env.CUDA_CORE_ARTIFACTS_DIR }}"/cu"${BUILD_PREV_CUDA_MAJOR}"/cuda_core*.whl \

.github/workflows/coverage.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -82,6 +82,9 @@ jobs:
8282
# we use self-hosted runners on which setup-python behaves weirdly...
8383
AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
8484

85+
- name: Install uv
86+
uses: astral-sh/setup-uv@v5
87+
8588
- name: Set up mini CTK
8689
if: ${{ env.LOCAL_CTK == '1' }}
8790
uses: ./.github/actions/fetch_ctk
@@ -92,29 +95,29 @@ jobs:
9295

9396
- name: Create venv
9497
run: |
95-
python -m venv .venv
98+
uv venv .venv
9699
97100
- name: Build cuda-pathfinder
98101
run: |
99-
.venv/bin/pip install -v ./cuda_pathfinder
102+
uv pip install --python .venv/bin/python -v ./cuda_pathfinder
100103
101104
- name: Build cuda-python-test-helpers
102105
run: |
103-
.venv/bin/pip install -v ./cuda_python_test_helpers
106+
uv pip install --python .venv/bin/python -v ./cuda_python_test_helpers
104107
105108
- name: Build cuda-bindings
106109
run: |
107-
cd cuda_bindings
108-
../.venv/bin/pip install -v . --group test
110+
uv pip install --python .venv/bin/python -v ./cuda_bindings
111+
cd cuda_bindings && uv sync --python ../.venv/bin/python --package cuda-bindings --only-group test --no-install-project && cd ..
109112
110113
- name: Build cuda-core
111114
run: |
112-
cd cuda_core
113-
../.venv/bin/pip install -v . --group test
115+
uv pip install --python .venv/bin/python -v ./cuda_core
116+
cd cuda_core && uv sync --python ../.venv/bin/python --package cuda-core --only-group "test-cu$(cut -d. -f1 <<< $CUDA_VER)" --no-install-project && cd ..
114117
115118
- name: Install coverage tools
116119
run: |
117-
.venv/bin/pip install coverage pytest-cov
120+
uv pip install --python .venv/bin/python coverage pytest-cov
118121
119122
- name: Set cuda package install root
120123
run: |

.github/workflows/test-wheel-linux.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ jobs:
224224
# we use self-hosted runners on which setup-python behaves weirdly (Python include can't be found)...
225225
AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
226226

227+
- name: Install uv
228+
uses: astral-sh/setup-uv@v5
229+
227230
- name: Set up mini CTK
228231
if: ${{ matrix.LOCAL_CTK == '1' }}
229232
uses: ./.github/actions/fetch_ctk
@@ -279,17 +282,18 @@ jobs:
279282
- name: Ensure cuda-python installable
280283
run: |
281284
if [[ "${{ matrix.LOCAL_CTK }}" == 1 ]]; then
282-
pip install --only-binary=:all: cuda_python*.whl
285+
uv pip install cuda_python*.whl
283286
else
284-
pip install --only-binary=:all: $(ls cuda_python*.whl)[all]
287+
uv pip install $(ls cuda_python*.whl)[all]
285288
fi
286289
287290
- name: Install cuda.pathfinder extra wheels for testing
288291
run: |
289292
set -euo pipefail
290293
pushd cuda_pathfinder
291-
pip install --only-binary=:all: -v ./*.whl --group "test-cu${TEST_CUDA_MAJOR}"
292-
pip list
294+
uv pip install -v ./*.whl
295+
uv sync --package cuda-pathfinder --only-group "test-cu${TEST_CUDA_MAJOR}" --no-install-project
296+
uv pip list
293297
popd
294298
295299
- name: Run cuda.pathfinder tests with all_must_work

.github/workflows/test-wheel-windows.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ jobs:
208208
with:
209209
python-version: ${{ matrix.PY_VER }}
210210

211+
- name: Install uv
212+
uses: astral-sh/setup-uv@v5
213+
211214
- name: Set up mini CTK
212215
if: ${{ matrix.LOCAL_CTK == '1' }}
213216
uses: ./.github/actions/fetch_ctk
@@ -254,19 +257,21 @@ jobs:
254257
run: run-tests core
255258

256259
- name: Ensure cuda-python installable
260+
shell: bash --noprofile --norc -xeuo pipefail {0}
257261
run: |
258-
if ('${{ matrix.LOCAL_CTK }}' -eq '1') {
259-
pip install --only-binary=:all: (Get-ChildItem -Filter cuda_python*.whl).FullName
260-
} else {
261-
pip install --only-binary=:all: "$((Get-ChildItem -Filter cuda_python*.whl).FullName)[all]"
262-
}
262+
if [[ "${{ matrix.LOCAL_CTK }}" == 1 ]]; then
263+
uv pip install cuda_python*.whl
264+
else
265+
uv pip install $(ls cuda_python*.whl)[all]
266+
fi
263267
264268
- name: Install cuda.pathfinder extra wheels for testing
265269
shell: bash --noprofile --norc -xeuo pipefail {0}
266270
run: |
267271
pushd cuda_pathfinder
268-
pip install --only-binary=:all: -v ./*.whl --group "test-cu${TEST_CUDA_MAJOR}"
269-
pip list
272+
uv pip install -v ./*.whl
273+
uv sync --package cuda-pathfinder --only-group "test-cu${TEST_CUDA_MAJOR}" --no-install-project
274+
uv pip list
270275
popd
271276
272277
- name: Run cuda.pathfinder tests with all_must_work

.pre-commit-config.yaml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ repos:
2929
language: python
3030
additional_dependencies:
3131
- https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl
32-
exclude: '(.*pixi\.lock)|(\.git_archival\.txt)'
32+
exclude: '(.*pixi\.lock)|(\.git_archival\.txt)|uv\.lock'
3333
args: ["--fix"]
3434

3535
- id: no-markdown-in-docs-source
@@ -46,7 +46,7 @@ repos:
4646
rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0
4747
hooks:
4848
- id: check-added-large-files
49-
exclude: cuda_bindings/cuda/bindings/nvml.pyx
49+
exclude: 'cuda_bindings/cuda/bindings/nvml\.pyx|uv\.lock'
5050
- id: check-case-conflict
5151
- id: check-docstring-first
5252
- id: check-merge-conflict
@@ -55,12 +55,9 @@ repos:
5555
- id: check-yaml
5656
- id: debug-statements
5757
- id: end-of-file-fixer
58-
exclude: &gen_exclude '^(?:cuda_python/README\.md|cuda_bindings/cuda/bindings/.*\.in?|cuda_bindings/docs/source/module/.*\.rst?)$'
5958
- id: mixed-line-ending
6059
- id: trailing-whitespace
61-
exclude: *gen_exclude
6260

63-
# Checking for common mistakes
6461
- repo: https://github.com/pre-commit/pygrep-hooks
6562
rev: "3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316" # frozen: v1.10.0
6663
hooks:
@@ -69,27 +66,22 @@ repos:
6966
- id: rst-inline-touching-normal
7067

7168
- repo: https://github.com/pre-commit/mirrors-mypy
72-
rev: a66e98df7b4aeeb3724184b332785976d062b92e # frozen: v1.19.1
69+
rev: "3fa3bf0572b3af5e0b2fba0b6e76a1e0c4e1fdee" # frozen: v1.16.1
7370
hooks:
74-
- id: mypy
75-
name: mypy-pathfinder
76-
files: ^cuda_pathfinder/cuda/.*\.py$ # Exclude tests directory
77-
args: [--config-file=cuda_pathfinder/pyproject.toml]
71+
- id: mypy
72+
name: mypy-pathfinder
73+
args: ["--config-file=cuda_pathfinder/pyproject.toml"]
74+
files: "^cuda_pathfinder/"
75+
exclude: "^cuda_pathfinder/tests/"
7876

7977
- repo: https://github.com/rhysd/actionlint
80-
rev: "0933c147c9d6587653d45fdcb4c497c57a65f9af" # frozen: v1.7.10
78+
rev: "a1bcb27e3e8727e0b92d7d36c5a6f4b076b32b34" # frozen: v1.7.7
8179
hooks:
8280
- id: actionlint
83-
args: ["-shellcheck="]
84-
exclude: ^\.github/workflows/coverage.yml$
81+
name: Lint GitHub Actions workflow files
8582

8683
- repo: https://github.com/MarcoGorelli/cython-lint
87-
rev: "d9ff7ce99ef4f2ae8fba93079ca9d76c4651d4ac" # frozen: v0.18.0
84+
rev: "48ca7bf3eb3d0bba6c3e76ba43b0a9e0a1f9bcc9" # frozen: v0.16.6
8885
hooks:
89-
- id: cython-lint
90-
args: [--no-pycodestyle]
91-
exclude: ^cuda_bindings/
92-
93-
94-
default_language_version:
95-
python: python3
86+
- id: cython-lint
87+
args: ['--max-line-length=320']

0 commit comments

Comments
 (0)