Skip to content
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

enforce pre-commit checks in CI, add verify-copyright hook #87

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:
jobs:
pr-builder:
needs:
- checks
- conda-python-build
- wheel-build
- telemetry-setup
Expand All @@ -28,6 +29,14 @@ jobs:
# since other jobs depend on it.
if: ${{ vars.TELEMETRY_ENABLED == 'true' }}
uses: rapidsai/shared-actions/telemetry-dispatch-stash-base-env-vars@main
checks:
runs-on: ubuntu-latest
needs: telemetry-setup
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: pre-commit/action@v3.0.1
conda-python-build:
secrets: inherit
needs: telemetry-setup
Expand Down
15 changes: 12 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,29 @@ exclude: ".*__rdd_patch_.*"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
rev: v0.9.6
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
args: ["--severity=warning"]
- repo: https://github.com/rapidsai/pre-commit-hooks
rev: v0.6.0
hooks:
- id: verify-copyright

default_language_version:
python: python3
4 changes: 2 additions & 2 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
# Copyright (c) 2023-2025, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -15,5 +15,5 @@ python -m pip wheel . -w dist -vv --no-deps --disable-pip-version-check
RAPIDS_PY_WHEEL_NAME="rapids-dask-dependency" RAPIDS_PY_WHEEL_PURE="1" rapids-upload-wheels-to-s3 dist

# Run tests
python -m pip install $(ls dist/*.whl)[test]
python -m pip install "$(echo dist/*.whl)[test]"
python -m pytest -v tests/
1 change: 0 additions & 1 deletion rapids_dask_dependency/patches/distributed/comm/ucx.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Copyright (c) 2025, NVIDIA CORPORATION.
import sys

from rapids_dask_dependency.loaders import make_vendored_loader

Expand Down
14 changes: 9 additions & 5 deletions tests/test_patch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) 2024-2025, NVIDIA CORPORATION.

import contextlib
import subprocess
import tempfile
Expand All @@ -8,16 +10,18 @@
def run_test_in_subprocess(func):
def redirect_stdout_stderr(func, stdout, stderr, *args, **kwargs):
with open(stdout, "w") as stdout_file, open(stderr, "w") as stderr_file:
with contextlib.redirect_stdout(stdout_file), contextlib.redirect_stderr(
stderr_file
with (
contextlib.redirect_stdout(stdout_file),
contextlib.redirect_stderr(stderr_file),
):
func(*args, **kwargs)

@wraps(func)
def wrapper(*args, **kwargs):
with tempfile.NamedTemporaryFile(
mode="w+"
) as stdout, tempfile.NamedTemporaryFile(mode="w+") as stderr:
with (
tempfile.NamedTemporaryFile(mode="w+") as stdout,
tempfile.NamedTemporaryFile(mode="w+") as stderr,
):
p = Process(
target=redirect_stdout_stderr,
args=(func, stdout.name, stderr.name, *args),
Expand Down
Loading