Skip to content

Commit 332000a

Browse files
committed
Remove redundant Python conda recipe tests
1 parent 4e698ee commit 332000a

5 files changed

Lines changed: 115 additions & 38 deletions

File tree

‎.github/workflows/pr.yaml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- conda-cpp-tests
2121
- conda-cpp-checks
2222
- conda-python-build
23+
- conda-python-import-tests
2324
- conda-python-tests
2425
- rocky8-clib-standalone-build
2526
- rocky8-clib-tests
@@ -170,6 +171,7 @@ jobs:
170171
- '!ci/run_cuvs_pytests.sh'
171172
- '!ci/test_cpp.sh'
172173
- '!ci/test_python.sh'
174+
- '!ci/test_python_imports.sh'
173175
- '!ci/test_wheel_cuvs.sh'
174176
- '!ci/validate_wheel.sh'
175177
- '!conda/environments/**'
@@ -285,6 +287,7 @@ jobs:
285287
- '!ci/test_java.sh'
286288
- '!ci/test_lucene.sh'
287289
- '!ci/test_python.sh'
290+
- '!ci/test_python_imports.sh'
288291
- '!ci/test_standalone_c.sh'
289292
- '!ci/validate_wheel.sh'
290293
- '!CODEOWNERS'
@@ -345,6 +348,7 @@ jobs:
345348
- '!ci/test_java.sh'
346349
- '!ci/test_lucene.sh'
347350
- '!ci/test_python.sh'
351+
- '!ci/test_python_imports.sh'
348352
- '!ci/test_wheel_cuvs.sh'
349353
- '!ci/validate_wheel.sh'
350354
- '!docs/**'
@@ -398,6 +402,7 @@ jobs:
398402
- '!ci/test_java.sh'
399403
- '!ci/test_lucene.sh'
400404
- '!ci/test_python.sh'
405+
- '!ci/test_python_imports.sh'
401406
- '!ci/test_standalone_c.sh'
402407
- '!ci/test_wheel_cuvs.sh'
403408
- '!ci/validate_wheel.sh'
@@ -546,6 +551,26 @@ jobs:
546551
# Build a conda package for each CUDA x ARCH x minimum supported Python version
547552
matrix_filter: group_by({CUDA_VER, ARCH}) | map(min_by(.PY_VER | split(".") | map(tonumber)))
548553
matrix_type: pull-request
554+
conda-python-import-tests:
555+
# Installs the built Python packages with only their runtime dependencies and imports them on a
556+
# CPU-only runner. This used to run as recipe tests inside conda-python-build; running it here
557+
# keeps it off the critical path of the GPU test jobs.
558+
needs: [conda-python-build, changed-files]
559+
permissions:
560+
actions: read
561+
contents: read
562+
id-token: write
563+
packages: read
564+
pull-requests: read
565+
secrets: inherit # zizmor: ignore[secrets-inherit]
566+
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
567+
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda
568+
with:
569+
build_type: pull-request
570+
node_type: cpu8
571+
arch: "amd64"
572+
container_image: "rapidsai/ci-conda:26.12-latest"
573+
script: "ci/test_python_imports.sh"
549574
conda-python-tests:
550575
needs: [conda-python-build, changed-files]
551576
permissions:

‎ci/test_python_imports.sh‎

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Install the built cuVS Conda packages with only their runtime dependencies
6+
# and import them on a CPU-only runner. This replaces the import tests that
7+
# used to run inside each recipe build, taking them off the critical path of
8+
# the GPU test jobs, and checks that nothing links against the CUDA driver or
9+
# initializes CUDA at import time.
10+
11+
set -euo pipefail
12+
13+
source /opt/conda/etc/profile.d/conda.sh
14+
15+
rapids-logger "Downloading built Conda packages"
16+
CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuvs cuvs --cuda "$RAPIDS_CUDA_VERSION")")
17+
PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuvs cuvs --stable --cuda "$RAPIDS_CUDA_VERSION")")
18+
19+
# Create an environment holding the given built packages and their runtime
20+
# dependencies, then import the given Python modules in it.
21+
#
22+
# usage: import_packages <env name> <package glob> [<package glob> ...] -- <module> [<module> ...]
23+
import_packages() {
24+
local env_name="$1"
25+
shift
26+
local packages=()
27+
while [[ "$1" != "--" ]]; do
28+
packages+=("$1")
29+
shift
30+
done
31+
shift
32+
33+
rapids-logger "Install ${packages[*]} with only their runtime dependencies"
34+
rapids-mamba-retry create --yes --name "${env_name}" --strict-channel-priority \
35+
--override-channels \
36+
--channel "${PYTHON_CHANNEL}" --channel "${CPP_CHANNEL}" \
37+
--channel rapidsai-nightly --channel conda-forge \
38+
"python=${RAPIDS_PY_VERSION}" "${packages[@]}"
39+
40+
set +u
41+
conda activate "${env_name}"
42+
set -u
43+
rapids-print-env
44+
45+
for module in "$@"; do
46+
rapids-logger "Import ${module} on a CPU-only runner"
47+
python -c "import ${module}"
48+
done
49+
50+
rapids-logger "Check that cuvs_bench ships its dataset configuration"
51+
python -c "import cuvs_bench, pathlib; path = pathlib.Path(cuvs_bench.__file__).parent / 'config' / 'datasets' / 'datasets.yaml'; assert path.is_file(), path"
52+
53+
set +u
54+
conda deactivate
55+
set -u
56+
}
57+
58+
# cuvs-bench and cuvs-bench-cpu both provide the cuvs_bench module, so they
59+
# are checked in separate environments.
60+
import_packages python_imports \
61+
"${PYTHON_CHANNEL}"/linux-64/cuvs-[0-9]*.conda \
62+
"${PYTHON_CHANNEL}"/linux-64/cuvs-bench-[0-9]*.conda \
63+
-- \
64+
cuvs \
65+
cuvs.cluster \
66+
cuvs.common \
67+
cuvs.distance \
68+
cuvs.neighbors \
69+
cuvs.preprocessing \
70+
cuvs_bench \
71+
cuvs_bench.generate_groundtruth \
72+
cuvs_bench.get_dataset \
73+
cuvs_bench.plot \
74+
cuvs_bench.run \
75+
cuvs_bench.split_groundtruth
76+
77+
# cuvs-bench-cpu is only built for one CUDA major version (see ci/build_python.sh).
78+
if compgen -G "${PYTHON_CHANNEL}/linux-64/cuvs-bench-cpu-[0-9]*.conda" > /dev/null; then
79+
import_packages python_imports_cpu \
80+
"${PYTHON_CHANNEL}"/linux-64/cuvs-bench-cpu-[0-9]*.conda \
81+
-- \
82+
cuvs_bench \
83+
cuvs_bench.generate_groundtruth \
84+
cuvs_bench.get_dataset \
85+
cuvs_bench.plot \
86+
cuvs_bench.run \
87+
cuvs_bench.split_groundtruth
88+
else
89+
rapids-logger "No cuvs-bench-cpu package was built for CUDA ${RAPIDS_CUDA_VERSION}; skipping"
90+
fi

‎conda/recipes/cuvs-bench-cpu/recipe.yaml‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ context:
99
linux64: ${{ linux and x86_64 }}
1010
py_abi_min: ${{ env.get("RAPIDS_PY_VERSION") }}
1111
py_buildstring: ${{ py_abi_min | version_to_buildstring }}
12-
py_runtime_latest: "3.14"
1312

1413
package:
1514
name: cuvs-bench-cpu
@@ -118,19 +117,6 @@ requirements:
118117
- libcublas
119118
- mkl # relaxes pin from host `mkl-devel`
120119

121-
122-
tests:
123-
- python:
124-
imports:
125-
- cuvs_bench
126-
- cuvs_bench.generate_groundtruth
127-
- cuvs_bench.get_dataset
128-
- cuvs_bench.plot
129-
- cuvs_bench.run
130-
- cuvs_bench.split_groundtruth
131-
python_version: ${{ py_runtime_latest }}.*
132-
pip_check: false
133-
134120
about:
135121
homepage: ${{ load_from_file("python/cuvs_bench/pyproject.toml").project.urls.Homepage }}
136122
license: ${{ load_from_file("python/cuvs_bench/pyproject.toml").project.license }}

‎conda/recipes/cuvs-bench/recipe.yaml‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ context:
1111
head_rev: '${{ git.head_rev(".")[:8] }}'
1212
py_abi_min: ${{ env.get("RAPIDS_PY_VERSION") }}
1313
py_buildstring: ${{ py_abi_min | version_to_buildstring }}
14-
py_runtime_latest: "3.14"
1514

1615
package:
1716
name: cuvs-bench
@@ -60,21 +59,6 @@ requirements:
6059
by_name:
6160
- cuda-version
6261

63-
tests:
64-
- package_contents:
65-
files:
66-
- site-packages/cuvs_bench/config/datasets/datasets.yaml
67-
- python:
68-
imports:
69-
- cuvs_bench
70-
- cuvs_bench.generate_groundtruth
71-
- cuvs_bench.get_dataset
72-
- cuvs_bench.plot
73-
- cuvs_bench.run
74-
- cuvs_bench.split_groundtruth
75-
python_version: ${{ py_runtime_latest }}.*
76-
pip_check: false
77-
7862
about:
7963
homepage: ${{ load_from_file("python/cuvs_bench/pyproject.toml").project.urls.Homepage }}
8064
license: ${{ load_from_file("python/cuvs_bench/pyproject.toml").project.license }}

‎conda/recipes/cuvs/recipe.yaml‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ context:
1111
head_rev: '${{ git.head_rev(".")[:8] }}'
1212
py_abi_min: ${{ env.get("RAPIDS_PY_VERSION") }}
1313
py_buildstring: ${{ py_abi_min | version_to_buildstring }}
14-
py_runtime_latest: "3.14"
1514

1615
package:
1716
name: cuvs
@@ -99,13 +98,6 @@ requirements:
9998
- cuda-version
10099
- cuda-cudart
101100

102-
tests:
103-
- python:
104-
imports:
105-
- cuvs
106-
python_version: ${{ py_runtime_latest }}.*
107-
pip_check: false
108-
109101
about:
110102
homepage: ${{ load_from_file("python/cuvs/pyproject.toml").project.urls.Homepage }}
111103
license: ${{ load_from_file("python/cuvs/pyproject.toml").project.license }}

0 commit comments

Comments
 (0)