Skip to content

Commit b9ecde4

Browse files
committed
Merge branch 'main' into subtests2
2 parents 626a431 + 1f9e9a4 commit b9ecde4

238 files changed

Lines changed: 11464 additions & 5378 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: griffe API check
6+
7+
description: >-
8+
Check a package's public API (as defined by `__all__`) for changes using
9+
griffe.
10+
11+
inputs:
12+
package-name:
13+
description: "Importable package name to check, e.g. cuda.core"
14+
required: true
15+
package-dir:
16+
description: "Directory to search for the package sources, e.g. cuda_core"
17+
required: true
18+
merge-base:
19+
description: >-
20+
Git ref/sha to compare the current code against, typically the PR's
21+
merge-base with its target branch.
22+
required: true
23+
24+
runs:
25+
using: composite
26+
steps:
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
29+
with:
30+
enable-cache: false
31+
32+
- name: Check API
33+
shell: bash --noprofile --norc -euo pipefail {0}
34+
env:
35+
PACKAGE_NAME: ${{ inputs.package-name }}
36+
PACKAGE_DIR: ${{ inputs.package-dir }}
37+
MERGE_BASE: ${{ inputs.merge-base }}
38+
run: |
39+
uvx griffe check "$PACKAGE_NAME" \
40+
--search "$PACKAGE_DIR" \
41+
--find-stubs-packages \
42+
--against "$MERGE_BASE" \
43+
--format github \
44+
2>&1

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

Lines changed: 85 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,19 @@ jobs:
150150
run: |
151151
twine check --strict cuda_pathfinder/*.whl
152152
153+
- name: Constrain builds to the local cuda.pathfinder wheel
154+
run: |
155+
pathfinder_wheels=(cuda_pathfinder/cuda_pathfinder-*.whl)
156+
test "${#pathfinder_wheels[@]}" -eq 1
157+
test -f "${pathfinder_wheels[0]}"
158+
mkdir -p wheel-constraints
159+
if [[ "${{ inputs.host-platform }}" == win* ]]; then
160+
pathfinder_uri="file:///$(cygpath -am "${pathfinder_wheels[0]}")"
161+
else
162+
pathfinder_uri="file:///host$(realpath "${pathfinder_wheels[0]}")"
163+
fi
164+
printf 'cuda-pathfinder @ %s\n' "${pathfinder_uri}" | tee wheel-constraints/cuda-bindings.txt
165+
153166
- name: Upload cuda.pathfinder build artifacts
154167
if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }}
155168
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -166,12 +179,14 @@ jobs:
166179
cuda-version: ${{ inputs.cuda-version }}
167180

168181
- name: Build cuda.bindings wheel
169-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
182+
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
170183
with:
171184
package-dir: ./cuda_bindings/
172185
output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
173186
env:
174187
CIBW_BUILD: ${{ env.CIBW_BUILD }}
188+
CIBW_BEFORE_BUILD_LINUX: 'python -m pip install --upgrade "pip>=25.3"'
189+
CIBW_BEFORE_BUILD_WINDOWS: 'python -m pip install --upgrade "pip>=25.3" delvewheel'
175190
# TODO: remove cpython-prerelease once 3.15 is officially supported
176191
# Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a
177192
# no-op for stable Python versions because CIBW_BUILD still filters
@@ -181,6 +196,8 @@ jobs:
181196
CIBW_ENVIRONMENT_LINUX: >
182197
CUDA_PATH=/host/${{ env.CUDA_PATH }}
183198
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
199+
PIP_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-bindings.txt
200+
PIP_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-bindings.txt
184201
CC="/host/${{ env.SCCACHE_PATH }} cc"
185202
CXX="/host/${{ env.SCCACHE_PATH }} c++"
186203
SCCACHE_GHA_ENABLED=true
@@ -194,6 +211,8 @@ jobs:
194211
CIBW_ENVIRONMENT_WINDOWS: >
195212
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
196213
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
214+
PIP_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-bindings.txt)"
215+
PIP_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-bindings.txt)"
197216
# check cache stats before leaving cibuildwheel
198217
CIBW_BEFORE_TEST_LINUX: >
199218
"/host/${{ env.SCCACHE_PATH }}" --show-adv-stats &&
@@ -226,6 +245,27 @@ jobs:
226245
run: |
227246
twine check --strict ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl
228247
248+
- name: Constrain cuda.core to the local cuda.bindings wheel
249+
run: |
250+
pathfinder_wheels=(cuda_pathfinder/cuda_pathfinder-*.whl)
251+
bindings_wheels=("${CUDA_BINDINGS_ARTIFACTS_DIR}"/cuda_bindings-"${BUILD_CUDA_MAJOR}".*.whl)
252+
test "${#pathfinder_wheels[@]}" -eq 1
253+
test "${#bindings_wheels[@]}" -eq 1
254+
test -f "${pathfinder_wheels[0]}"
255+
test -f "${bindings_wheels[0]}"
256+
mkdir -p wheel-constraints
257+
if [[ "${{ inputs.host-platform }}" == win* ]]; then
258+
pathfinder_uri="file:///$(cygpath -am "${pathfinder_wheels[0]}")"
259+
bindings_uri="file:///$(cygpath -am "${bindings_wheels[0]}")"
260+
else
261+
pathfinder_uri="file:///host$(realpath "${pathfinder_wheels[0]}")"
262+
bindings_uri="file:///host$(realpath "${bindings_wheels[0]}")"
263+
fi
264+
{
265+
printf 'cuda-pathfinder @ %s\n' "${pathfinder_uri}"
266+
printf 'cuda-bindings @ %s\n' "${bindings_uri}"
267+
} | tee wheel-constraints/cuda-core.txt
268+
229269
- name: Upload cuda.bindings build artifacts
230270
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
231271
with:
@@ -234,12 +274,14 @@ jobs:
234274
if-no-files-found: error
235275

236276
- name: Build cuda.core wheel
237-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
277+
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
238278
with:
239279
package-dir: ./cuda_core/
240280
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
241281
env:
242282
CIBW_BUILD: ${{ env.CIBW_BUILD }}
283+
CIBW_BEFORE_BUILD_LINUX: 'python -m pip install --upgrade "pip>=25.3"'
284+
CIBW_BEFORE_BUILD_WINDOWS: 'python -m pip install --upgrade "pip>=25.3" delvewheel'
243285
# TODO: remove cpython-prerelease once 3.15 is officially supported
244286
# Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a
245287
# no-op for stable Python versions because CIBW_BUILD still filters
@@ -250,7 +292,8 @@ jobs:
250292
CUDA_PATH=/host/${{ env.CUDA_PATH }}
251293
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
252294
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }}
253-
PIP_FIND_LINKS=/host/${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
295+
PIP_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core.txt
296+
PIP_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core.txt
254297
CC="/host/${{ env.SCCACHE_PATH }} cc"
255298
CXX="/host/${{ env.SCCACHE_PATH }} c++"
256299
SCCACHE_GHA_ENABLED=true
@@ -265,7 +308,8 @@ jobs:
265308
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
266309
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
267310
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }}
268-
PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
311+
PIP_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core.txt)"
312+
PIP_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core.txt)"
269313
# check cache stats before leaving cibuildwheel
270314
CIBW_BEFORE_TEST_LINUX: >
271315
"/host${{ env.SCCACHE_PATH }}" --show-adv-stats &&
@@ -342,6 +386,12 @@ jobs:
342386
# TODO: remove allow-prereleases once 3.15 is officially supported
343387
allow-prereleases: ${{ startsWith(matrix.python-version, '3.15') }}
344388

389+
- name: Enable Scientific Python Nightly Wheels for Python 3.15
390+
if: ${{ startsWith(matrix.python-version, '3.15') }}
391+
run: |
392+
echo "PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" >> "$GITHUB_ENV"
393+
echo "PIP_ONLY_BINARY=numpy" >> "$GITHUB_ENV"
394+
345395
- name: verify free-threaded build
346396
if: endsWith(matrix.python-version, 't')
347397
run: python -c 'import sys; assert not sys._is_gil_enabled()'
@@ -367,64 +417,6 @@ jobs:
367417
mv "/c/Program Files/Git/usr/bin/link.exe" "/c/Program Files/Git/usr/bin/link.exe.bak"
368418
fi
369419
370-
# TODO: remove the numpy pre-build steps once 3.15 is officially supported
371-
# (numpy will publish pre-built 3.15 wheels at that point)
372-
- name: Download and patch numpy sdist (pre-release Python)
373-
if: ${{ startsWith(matrix.python-version, '3.15') }}
374-
run: |
375-
pip download --no-binary numpy --no-deps "numpy>=1.21.1" -d numpy-sdist/
376-
cd numpy-sdist && tar xf numpy-*.tar.gz && rm numpy-*.tar.gz
377-
# WAR: numpy 2.4.x ships [tool.cibuildwheel] config that is
378-
# incompatible with cibuildwheel v4.0 (cpython-freethreading enable
379-
# group, OpenBLAS before-build scripts, etc.). Strip the cibuildwheel
380-
# sections but preserve [tool.meson-python] (vendored meson path).
381-
python -c "
382-
import glob
383-
for f in glob.glob('numpy-*/pyproject.toml'):
384-
lines, skip = open(f).readlines(), False
385-
out = []
386-
for line in lines:
387-
hdr = line.strip()
388-
if hdr.startswith('[tool.cibuildwheel') or hdr.startswith('[[tool.cibuildwheel'):
389-
skip = True
390-
continue
391-
if skip and hdr.startswith('[') and 'cibuildwheel' not in hdr:
392-
skip = False
393-
if not skip:
394-
out.append(line)
395-
open(f, 'w').writelines(out)
396-
"
397-
echo "NUMPY_SRC_DIR=$(pwd)/$(ls -d numpy-*/)" >> $GITHUB_ENV
398-
399-
- name: Build numpy wheel (pre-release Python)
400-
if: ${{ startsWith(matrix.python-version, '3.15') }}
401-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
402-
env:
403-
CIBW_BUILD: ${{ env.CIBW_BUILD }}
404-
CIBW_SKIP: "*-musllinux* *-win32"
405-
CIBW_ARCHS_LINUX: "native"
406-
CIBW_BUILD_VERBOSITY: 1
407-
CIBW_CONFIG_SETTINGS: "setup-args=-Dallow-noblas=true"
408-
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv setup-args=-Dallow-noblas=true"
409-
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
410-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
411-
CIBW_ENABLE: "cpython-prerelease"
412-
with:
413-
package-dir: ${{ env.NUMPY_SRC_DIR }}
414-
output-dir: numpy-wheel/
415-
416-
- name: Upload numpy wheel
417-
if: ${{ startsWith(matrix.python-version, '3.15') }}
418-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
419-
with:
420-
name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }}
421-
path: numpy-wheel/*.whl
422-
if-no-files-found: error
423-
424-
- name: Install numpy wheel
425-
if: ${{ startsWith(matrix.python-version, '3.15') }}
426-
run: pip install numpy-wheel/*.whl
427-
428420
- name: Build cuda.bindings Cython tests
429421
run: |
430422
pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings/pyproject.toml:test
@@ -496,21 +488,45 @@ jobs:
496488
OLD_BRANCH=$(yq '.backport_branch' ci/versions.yml)
497489
OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}*"
498490
LATEST_PRIOR_RUN_ID=$(./ci/tools/lookup-run-id --branch "${OLD_BRANCH}" NVIDIA/cuda-python "CI")
491+
PREV_BINDINGS_DIR="cuda_bindings/dist-prev"
499492
500493
gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python
501494
rm -rf ${OLD_BASENAME}-tests # exclude cython test artifacts
502495
ls -al $OLD_BASENAME
503-
mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
504-
mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
496+
mkdir -p "${PREV_BINDINGS_DIR}"
497+
mv $OLD_BASENAME/*.whl "${PREV_BINDINGS_DIR}"
505498
rmdir $OLD_BASENAME
506499
500+
- name: Constrain previous cuda.core to the downloaded cuda.bindings wheel
501+
run: |
502+
pathfinder_wheels=(cuda_pathfinder/cuda_pathfinder-*.whl)
503+
bindings_wheels=(cuda_bindings/dist-prev/cuda_bindings-"${BUILD_PREV_CUDA_MAJOR}".*.whl)
504+
test "${#pathfinder_wheels[@]}" -eq 1
505+
test "${#bindings_wheels[@]}" -eq 1
506+
test -f "${pathfinder_wheels[0]}"
507+
test -f "${bindings_wheels[0]}"
508+
mkdir -p wheel-constraints
509+
if [[ "${{ inputs.host-platform }}" == win* ]]; then
510+
pathfinder_uri="file:///$(cygpath -am "${pathfinder_wheels[0]}")"
511+
bindings_uri="file:///$(cygpath -am "${bindings_wheels[0]}")"
512+
else
513+
pathfinder_uri="file:///host$(realpath "${pathfinder_wheels[0]}")"
514+
bindings_uri="file:///host$(realpath "${bindings_wheels[0]}")"
515+
fi
516+
{
517+
printf 'cuda-pathfinder @ %s\n' "${pathfinder_uri}"
518+
printf 'cuda-bindings @ %s\n' "${bindings_uri}"
519+
} | tee wheel-constraints/cuda-core-prev.txt
520+
507521
- name: Build cuda.core wheel
508-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
522+
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
509523
with:
510524
package-dir: ./cuda_core/
511525
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
512526
env:
513527
CIBW_BUILD: ${{ env.CIBW_BUILD }}
528+
CIBW_BEFORE_BUILD_LINUX: 'python -m pip install --upgrade "pip>=25.3"'
529+
CIBW_BEFORE_BUILD_WINDOWS: 'python -m pip install --upgrade "pip>=25.3" delvewheel'
514530
# TODO: remove cpython-prerelease once 3.15 is officially supported
515531
# Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a
516532
# no-op for stable Python versions because CIBW_BUILD still filters
@@ -521,7 +537,8 @@ jobs:
521537
CUDA_PATH=/host/${{ env.CUDA_PATH }}
522538
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
523539
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }}
524-
PIP_FIND_LINKS=/host/${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
540+
PIP_BUILD_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core-prev.txt
541+
PIP_CONSTRAINT=/host/${{ github.workspace }}/wheel-constraints/cuda-core-prev.txt
525542
CC="/host/${{ env.SCCACHE_PATH }} cc"
526543
CXX="/host/${{ env.SCCACHE_PATH }} c++"
527544
SCCACHE_GHA_ENABLED=true
@@ -536,7 +553,8 @@ jobs:
536553
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
537554
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
538555
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }}
539-
PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
556+
PIP_BUILD_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core-prev.txt)"
557+
PIP_CONSTRAINT="$(cygpath -w ./wheel-constraints/cuda-core-prev.txt)"
540558
# check cache stats before leaving cibuildwheel
541559
CIBW_BEFORE_TEST_LINUX: >
542560
"/host${{ env.SCCACHE_PATH }}" --show-adv-stats &&

0 commit comments

Comments
 (0)