-
Notifications
You must be signed in to change notification settings - Fork 655
test: isolate library wheel smoke test #8406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4f7aba2
7cd97d5
b07ba20
3b1baac
ff72cbd
9887ac1
7dba24c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION. | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -euo pipefail | ||
|
|
@@ -16,6 +16,17 @@ mkdir -p "${RAPIDS_TESTS_DIR}" | |
| # dependencies that can be installed later on when installing the wheel | ||
| rapids-generate-pip-constraints test_python "${PIP_CONSTRAINT}" | ||
|
|
||
| python -m venv libcuml-env | ||
| . libcuml-env/bin/activate | ||
|
|
||
| rapids-pip-retry install \ | ||
| -v \ | ||
| --prefer-binary \ | ||
| --constraint "${PIP_CONSTRAINT}" \ | ||
| "${LIBCUML_WHEELHOUSE}"/libcuml*.whl | ||
| python -c "import libcuml; assert (libraries := libcuml.load_library()) and all(libraries)" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- ci/test_wheel.sh ---'
cat -n ci/test_wheel.sh | sed -n '1,80p'
printf '%s\n' '--- related libcuml.load_library usage ---'
rg -n -C 3 'load_library|assert .*libraries|python -O|PYTHONOPTIMIZE' --glob '!build/**' --glob '!dist/**' .Repository: NVIDIA/cuml Length of output: 5740 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- python/libcuml/libcuml/load.py ---'
cat -n python/libcuml/libcuml/load.py | sed -n '1,110p'
printf '%s\n' '--- package metadata and CI optimization settings ---'
rg -n -C 2 'PYTHONOPTIMIZE|python -O|python -OO|load_library\(\)' ci python/libcuml pyproject.toml setup.py setup.cfg 2>/dev/null || true
printf '%s\n' '--- standalone assertion behavior ---'
python3 - <<'PY'
import subprocess
import sys
code = "libraries = []; assert libraries and all(libraries)"
for flags in ([], ["-O"]):
result = subprocess.run([sys.executable, *flags, "-c", code],
text=True, capture_output=True)
print({
"flags": flags or ["normal"],
"returncode": result.returncode,
"stderr": result.stderr.strip(),
})
PYRepository: NVIDIA/cuml Length of output: 5793 Raise an explicit error when 🤖 Prompt for AI AgentsSource: Path instructions 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- ci/test_wheel.sh ---'
sed -n '1,120p' ci/test_wheel.sh
printf '%s\n' '--- libcuml load implementation ---'
load_file="$(fd -t f -i '^load\.py$' . | head -n 1)"
printf 'file=%s\n' "$load_file"
sed -n '1,140p' "$load_file"
printf '%s\n' '--- related references ---'
rg -n --glob '!build/**' --glob '!dist/**' \
'RAPIDS_LIBCUML_PREFER_SYSTEM_LIBRARY|load_library\(|_load_system_installation|libcuml-env|test_wheel' .Repository: NVIDIA/cuml Length of output: 7851 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- libcuml package layout and packaging rules ---'
git ls-files 'python/libcuml' 'ci' | rg \
'(^|/)(pyproject\.toml|setup\.py|setup\.cfg|MANIFEST\.in|test_libcuml_linkage\.py|load\.py)$|lib64|wheel'
rg -n \
'lib64|libcuml\.so|package_data|data_files|RAPIDS_LIBCUML_PREFER_SYSTEM_LIBRARY|CDLL|_name|linkage' \
python/libcuml ci pyproject.toml setup.py setup.cfg 2>/dev/null || true
printf '%s\n' '--- existing linkage test ---'
linkage_file="$(fd -t f -i 'test_libcuml_linkage\.py$' . | head -n 1)"
printf 'file=%s\n' "$linkage_file"
sed -n '1,240p' "$linkage_file"
printf '%s\n' '--- loader call sites and environment setup ---'
rg -n -C 4 \
'libcuml\.load_library|RAPIDS_LIBCUML_PREFER_SYSTEM_LIBRARY|python -m venv|conda|rapids-init-pip' \
ci python/libcuml python/cumlRepository: NVIDIA/cuml Length of output: 47817 🏁 Script executed: #!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
script = Path("ci/test_wheel.sh").read_text()
loader = Path("python/libcuml/libcuml/load.py").read_text()
assert 'python -c "import libcuml; assert (libraries := libcuml.load_library()) and all(libraries)"' in script
assert 'os.getenv("RAPIDS_LIBCUML_PREFER_SYSTEM_LIBRARY", "false").lower()' in loader
assert 'if libcuml_lib is None:' in loader
assert 'libcuml_lib = _load_system_installation(soname)' in loader
def simulated_load(prefer_system, wheel_present, system_present):
wheel = "wheel-handle" if wheel_present else None
system = "system-handle" if system_present else None
if prefer_system:
handle = system if system is not None else wheel
else:
handle = wheel if wheel is not None else system
return [] if handle is None else [handle]
cases = {
"false + wheel present": simulated_load(False, True, True),
"false + wheel absent + system present": simulated_load(False, False, True),
"true + wheel present + system present": simulated_load(True, True, True),
}
for name, result in cases.items():
print(f"{name}: {result}")
assert cases["false + wheel absent + system present"] == ["system-handle"]
assert cases["false + wheel absent + system present"] != ["wheel-handle"]
command_line = next(
line for line in script.splitlines()
if "load_library()" in line and "python -c" in line
)
print(f"load assertion: {command_line}")
print("explicit loader-selection environment assignment:",
"RAPIDS_LIBCUML_PREFER_SYSTEM_LIBRARY=false" in command_line)
PYRepository: NVIDIA/cuml Length of output: 467 Make the wheel-load assertion reject system libraries.
🤖 Prompt for AI AgentsSource: Path instructions |
||
| deactivate | ||
|
|
||
| # notes: | ||
| # | ||
| # * just providing --constraint="${PIP_CONSTRAINT}" to be explicit, and because | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Create a fresh environment for every run.
python -m venv libcuml-envreuses an existing directory. If the CI workspace is reused, packages from an earlier run can satisfy imports that the current wheel does not provide.deactivatedoes not remove the directory, and failures before line 28 skip it.Use a unique
mktemp -ddirectory or clear the directory before creation. Register anEXITtrap to remove it.Proposed cleanup
📝 Committable suggestion
🧰 Tools
🪛 Shellcheck (0.11.0)
[info] 20-20: Not following: libcuml-env/bin/activate was not specified as input (see shellcheck -x).
(SC1091)
🤖 Prompt for AI Agents