Skip to content

Commit

Permalink
update pre-commit hook versions, mark wheels as pure python (#205)
Browse files Browse the repository at this point in the history
We recently observed some issues with Python 3.12 + older `flake8`
versions across RAPIDS:
rapidsai/build-planning#101.

This proposes updating all the pre-commit hooks in this repo
(`pre-commit autoupdate`) to avoid such issues the next time someone
comes to push new commits here.

While doing this, I also discovered that wheel CI here was broken by
rapidsai/shared-workflows#213 (see
#205 (comment)).
This fixes that as well.
  • Loading branch information
jameslamb authored Sep 24, 2024
1 parent ef7c08d commit cbef6a8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,31 @@ jobs:
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.10
with:
build_type: pull-request
# Package is pure Python and only ever requires one build.
matrix_filter: 'map(select(.ARCH == "amd64" and (.LINUX_VER | test("centos")|not))) | sort_by(.PY_VER | split(".") | map(tonumber)) | [.[-1]]'
# This selects "ARCH=amd64 + the latest supported Python + CUDA".
matrix_filter: map(select(.ARCH == "amd64")) | max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]) | [.]
conda-python-tests:
needs: conda-python-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.10
with:
build_type: pull-request
# Package is pure Python and only ever requires one build.
matrix_filter: 'map(select(.ARCH == "amd64" and (.LINUX_VER | test("centos")|not))) | sort_by(.PY_VER | split(".") | map(tonumber)) | [.[-1]]'
# This selects "ARCH=amd64 + the latest supported Python + CUDA".
matrix_filter: map(select(.ARCH == "amd64")) | max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]) | [.]
wheel-build:
needs: checks
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.10
with:
build_type: pull-request
# Package is pure Python and only ever requires one build.
matrix_filter: 'map(select((.LINUX_VER | test("centos")|not))) | sort_by((.PY_VER | split(".") | map(tonumber))) | [.[-1] + {ARCH: "amd64"}]'
# This selects the latest supported Python + CUDA
matrix_filter: max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]) | [.]
script: "ci/build_wheel.sh"
wheel-tests:
needs: wheel-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.10
with:
build_type: pull-request
# Package is pure Python and only ever requires one build.
matrix_filter: 'map(select(.ARCH == "amd64" and (.LINUX_VER | test("centos")|not))) | sort_by(.PY_VER | split(".") | map(tonumber)) | [.[-1]]'
script: "ci/test_wheel.sh"
# This selects the latest supported Python + CUDA
matrix_filter: max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]) | [.]
script: "ci/test_wheel.sh"
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

repos:
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.8.0
hooks:
- id: black
files: jupyterlab_nvdashboard/.*
# Explicitly specify the pyproject.toml at the repo root, not per-project.
args: ['--config', 'pyproject.toml']
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.1
hooks:
- id: flake8
args: ['--config=.flake8']
files: jupyterlab_nvdashboard/.*$
- repo: https://github.com/rapidsai/dependency-file-generator
rev: v1.13.11
rev: v1.14.0
hooks:
- id: rapids-dependency-file-generator
args: ['--clean']
Expand Down
2 changes: 1 addition & 1 deletion ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ python -m build -s -w

rapids-logger "Uploading JupyterLab NVDashboard wheels to S3"
# Upload Python wheels to S3
RAPIDS_PY_WHEEL_NAME="${package_name}" rapids-upload-wheels-to-s3 dist
RAPIDS_PY_WHEEL_NAME="${package_name}" RAPIDS_PY_WHEEL_PURE="1" rapids-upload-wheels-to-s3 dist
2 changes: 1 addition & 1 deletion ci/test_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -eou pipefail
package_name="jupyterlab-nvdashboard"

rapids-logger "Downloading artifacts from previous jobs"
RAPIDS_PY_WHEEL_NAME="${package_name}" rapids-download-wheels-from-s3 ./dist
RAPIDS_PY_WHEEL_NAME="${package_name}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 ./dist

# echo to expand wildcard before adding `[extra]` required for pip
python -m pip install $(echo ./dist/jupyterlab_nvdashboard*.whl)[test]
Expand Down
4 changes: 1 addition & 3 deletions jupyterlab_nvdashboard/apps/gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

# Maximum bandwidth is bidirectional, divide by 2 for separate RX & TX
max_bw = (
max(
sum(i.value.ullVal for i in bw) * 1024**2 for bw in bandwidth
)
max(sum(i.value.ullVal for i in bw) * 1024**2 for bw in bandwidth)
/ 2
)
except (IndexError, pynvml.nvml.NVMLError_NotSupported):
Expand Down
7 changes: 4 additions & 3 deletions jupyterlab_nvdashboard/tests/test_cpu_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ def mock_handler(monkeypatch):

@pytest.fixture
def handler_args():
with patch("tornado.web.Application") as mock_application, patch(
"tornado.httputil.HTTPServerRequest"
) as mock_request:
with (
patch("tornado.web.Application") as mock_application,
patch("tornado.httputil.HTTPServerRequest") as mock_request,
):
# Mock the settings to return appropriate values
mock_settings = {
"base_url": "/",
Expand Down
7 changes: 4 additions & 3 deletions jupyterlab_nvdashboard/tests/test_gpu_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ def mock_handler(monkeypatch):

@pytest.fixture
def handler_args():
with patch("tornado.web.Application") as mock_application, patch(
"tornado.httputil.HTTPServerRequest"
) as mock_request:
with (
patch("tornado.web.Application") as mock_application,
patch("tornado.httputil.HTTPServerRequest") as mock_request,
):
# Mock the settings to return appropriate values
mock_settings = {
"base_url": "/",
Expand Down

0 comments on commit cbef6a8

Please sign in to comment.