Skip to content

Commit

Permalink
enforce pre-commit checks in CI, add verify-copyright hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Feb 18, 2025
1 parent b34eb02 commit 594872a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
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/[email protected]
conda-python-build:
secrets: inherit
needs: telemetry-setup
Expand Down
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ 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/rapidsai/pre-commit-hooks
rev: v0.6.0
hooks:
- id: verify-copyright

default_language_version:
python: python3
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

0 comments on commit 594872a

Please sign in to comment.