Skip to content

Commit 1e7dcf2

Browse files
authored
refactor(deps): organize test and dev dependencies using dependency groups (#995)
1 parent 598874c commit 1e7dcf2

File tree

9 files changed

+22
-29
lines changed

9 files changed

+22
-29
lines changed

.github/workflows/build-wheel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ jobs:
227227
228228
- name: Build cuda.bindings Cython tests
229229
run: |
230-
pip install $(ls ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl)[test]
230+
pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings/pyproject.toml:test
231231
pushd ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}
232232
bash build_tests.sh
233233
popd
@@ -241,7 +241,7 @@ jobs:
241241

242242
- name: Build cuda.core Cython tests
243243
run: |
244-
pip install $(ls ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl)[test]
244+
pip install ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl --group ./cuda_core/pyproject.toml:test
245245
pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}
246246
bash build_tests.sh
247247
popd

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ jobs:
284284
run: |
285285
set -euo pipefail
286286
pushd cuda_pathfinder
287-
pip install --only-binary=:all: -v ".[test_nvidia_wheels_cu${TEST_CUDA_MAJOR},test_nvidia_wheels_host]"
287+
pip install --only-binary=:all: -v . --group "test_nvidia_wheels_cu${TEST_CUDA_MAJOR}" --group test_nvidia_wheels_host
288288
pip list
289289
popd
290290

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ jobs:
257257
shell: bash --noprofile --norc -xeuo pipefail {0}
258258
run: |
259259
pushd cuda_pathfinder
260-
pip install --only-binary=:all: -v ".[test_nvidia_wheels_cu${TEST_CUDA_MAJOR},test_nvidia_wheels_host]"
260+
pip install --only-binary=:all: -v . --group "test_nvidia_wheels_cu${TEST_CUDA_MAJOR}" --group test_nvidia_wheels_host
261261
pip list
262262
popd
263263

ci/tools/run-tests

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test_module=${1}
2424
# (it is a direct dependency of bindings, and a transitive dependency of core)
2525
pushd ./cuda_pathfinder
2626
echo "Installing pathfinder wheel"
27-
pip install $(ls *.whl)[test]
27+
pip install ./*.whl --group test
2828
popd
2929

3030
if [[ "${test_module}" == "pathfinder" ]]; then
@@ -38,15 +38,13 @@ if [[ "${test_module}" == "pathfinder" ]]; then
3838
echo "Number of \"INFO test_\" lines: $line_count"
3939
popd
4040
elif [[ "${test_module}" == "bindings" ]]; then
41-
pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}"
4241
echo "Installing bindings wheel"
42+
pushd ./cuda_bindings
4343
if [[ "${LOCAL_CTK}" == 1 ]]; then
44-
pip install $(ls *.whl)[test]
44+
pip install "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl --group test
4545
else
46-
pip install $(ls *.whl)[all,test]
46+
pip install $(ls "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl)[all] --group test
4747
fi
48-
popd
49-
pushd ./cuda_bindings
5048
echo "Running bindings tests"
5149
${SANITIZER_CMD} pytest -rxXs -v tests/
5250
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
@@ -57,33 +55,29 @@ elif [[ "${test_module}" == "core" ]]; then
5755
# If build/test majors match: cuda.bindings is installed in the previous step.
5856
# If mismatch: cuda.bindings is installed from the backport branch.
5957
if [[ "${SKIP_CUDA_BINDINGS_TEST}" == 1 ]]; then
60-
pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}"
6158
echo "Installing bindings wheel"
6259
if [[ "${LOCAL_CTK}" == 1 ]]; then
63-
pip install *.whl
60+
pip install "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl
6461
else
65-
pip install $(ls *.whl)[all]
62+
pip install $(ls "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl)[all]
6663
fi
67-
popd
6864
fi
6965
TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${CUDA_VER})"
70-
pushd "${CUDA_CORE_ARTIFACTS_DIR}"
7166
echo "Installing core wheel"
7267

7368
FREE_THREADING=""
7469
if python -c 'import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then
7570
FREE_THREADING+="-ft"
7671
fi
7772

73+
pushd ./cuda_core
7874
if [[ "${LOCAL_CTK}" == 1 ]]; then
7975
# We already installed cuda-bindings, and all CTK components exist locally,
8076
# so just install the test dependencies.
81-
pip install $(ls *.whl)["test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}"]
77+
pip install "${CUDA_CORE_ARTIFACTS_DIR}"/*.whl --group "test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}"
8278
else
83-
pip install $(ls *.whl)["cu${TEST_CUDA_MAJOR}","test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}"]
79+
pip install $(ls "${CUDA_CORE_ARTIFACTS_DIR}"/*.whl)["cu${TEST_CUDA_MAJOR}"] --group "test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}"
8480
fi
85-
popd
86-
pushd ./cuda_core
8781
echo "Running core tests"
8882
${SANITIZER_CMD} pytest -rxXs -v tests/
8983
# Currently our CI always installs the latest bindings (from either major version).

cuda_bindings/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
3-
43
[build-system]
54
requires = ["setuptools>=77.0.0", "cython>=3.1,<3.2", "pyclibrary>=0.1.7"]
65
build-backend = "setuptools.build_meta"
@@ -36,6 +35,7 @@ all = [
3635
"cuda-toolkit[cufile]==13.*; sys_platform == 'linux'",
3736
]
3837

38+
[dependency-groups]
3939
test = [
4040
"cython>=3.1,<3.2",
4141
"setuptools>=77.0.0",

cuda_core/pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ dependencies = [
4949
cu11 = ["cuda-bindings[all]==11.8.*"]
5050
cu12 = ["cuda-bindings[all]==12.*"]
5151
cu13 = ["cuda-bindings[all]==13.*"]
52-
# TODO: these should all be in development dependencies; optional dependencies
53-
# are for features exposed to *users*, not a dumping ground for all tooling
54-
# needed to build and test the project
55-
test = ["cython>=3.1", "setuptools", "pytest>=6.2.4"]
52+
53+
[dependency-groups]
54+
test = ["cython>=3.0", "setuptools", "pytest>=6.2.4"]
5655
test-cu11 = ["cuda-core[test]", "cupy-cuda11x; python_version < '3.14'", "cuda-toolkit[cudart]==11.*"] # runtime headers needed by CuPy
5756
test-cu12 = ["cuda-core[test]", "cupy-cuda12x; python_version < '3.14'", "cuda-toolkit[cudart]==12.*"] # runtime headers needed by CuPy
5857
test-cu13 = ["cuda-core[test]", "cupy-cuda13x; python_version < '3.14'", "cuda-toolkit[cudart]==13.*"] # runtime headers needed by CuPy

cuda_pathfinder/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ requires-python = ">=3.9"
1010
dynamic = ["version", "readme"]
1111
dependencies = []
1212

13-
[project.optional-dependencies]
13+
[dependency-groups]
1414
test = [
1515
"pytest>=6.2.4",
1616
]

scripts/run_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ ensure_installed() {
158158
fi
159159

160160
if [[ "${INSTALL_MODE}" == "force" ]]; then
161-
pip install -e .[test]
161+
pip install -e . --group test
162162
return 0
163163
fi
164164

@@ -177,7 +177,7 @@ sys.exit(0 if str(p).startswith(str(sub)) else 3)
177177
PY
178178
rc=$?
179179
if [[ $rc -ne 0 ]]; then
180-
pip install -e .[test]
180+
pip install -e . --group test
181181
fi
182182
}
183183

toolshed/collect_site_packages_so_files.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ fresh_venv() {
1717
cd cuda_pathfinder/
1818
fresh_venv ../TmpCp12Venv
1919
set -x
20-
pip install --only-binary=:all: -e .[test,test_nvidia_wheels_cu12,test_nvidia_wheels_host]
20+
pip install --only-binary=:all: -e . --group test --group test_nvidia_wheels_cu12 --group test_nvidia_wheels_host
2121
set +x
2222
deactivate
2323
fresh_venv ../TmpCp13Venv
2424
set -x
25-
pip install --only-binary=:all: -e .[test,test_nvidia_wheels_cu13,test_nvidia_wheels_host]
25+
pip install --only-binary=:all: -e . --group test --group test_nvidia_wheels_cu13 --group test_nvidia_wheels_host
2626
set +x
2727
deactivate
2828
cd ..

0 commit comments

Comments
 (0)