From a53ecc17f1829354e2d2ff58bbbad1d84ce568b2 Mon Sep 17 00:00:00 2001 From: Devulapalli Naga Sri Vaishnavi Date: Wed, 9 Sep 2026 14:20:41 +0530 Subject: [PATCH] fix: make pre-commit hooks portable on Windows (#6881) * fix: make pre-commit hooks portable on Windows * test: validate each pre-commit hook command * test: restore Bedrock module state after import check * test: keep provider module references in sync * fix: select virtualenv activation path by platform * chore(ci): ignore unpatched accelerate advisory * chore: keep Windows hook fix focused --------- Co-authored-by: Vidit Ostwal <110953813+Vidit-Ostwal@users.noreply.github.com> --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 06aa5fa880..64ec22459c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,19 +3,19 @@ repos: hooks: - id: ruff name: ruff - entry: bash -c 'source .venv/bin/activate && uv run ruff check --config pyproject.toml "$@"' -- + entry: bash -c 'case "$OSTYPE" in msys*|cygwin*|win32*) source .venv/Scripts/activate ;; *) source .venv/bin/activate ;; esac && uv run ruff check --config pyproject.toml "$@"' -- language: system pass_filenames: true types: [python] - id: ruff-format name: ruff-format - entry: bash -c 'source .venv/bin/activate && uv run ruff format --config pyproject.toml "$@"' -- + entry: bash -c 'case "$OSTYPE" in msys*|cygwin*|win32*) source .venv/Scripts/activate ;; *) source .venv/bin/activate ;; esac && uv run ruff format --config pyproject.toml "$@"' -- language: system pass_filenames: true types: [python] - id: mypy name: mypy - entry: bash -c 'source .venv/bin/activate && uv run mypy --config-file pyproject.toml "$@"' -- + entry: bash -c 'case "$OSTYPE" in msys*|cygwin*|win32*) source .venv/Scripts/activate ;; *) source .venv/bin/activate ;; esac && uv run mypy --config-file pyproject.toml "$@"' -- language: system pass_filenames: true types: [python] @@ -32,7 +32,7 @@ repos: # TODO: drop --ignore-vuln GHSA-8mgp-746c-j5xp when bumping nltk past 3.10.3. # TODO: drop --ignore-vuln GHSA-4j2p-28q2-5m79 when bumping accelerate past 1.14.0. entry: >- - bash -c 'source .venv/bin/activate && uv run pip-audit --skip-editable + bash -c 'case "$OSTYPE" in msys*|cygwin*|win32*) source .venv/Scripts/activate ;; *) source .venv/bin/activate ;; esac && uv run pip-audit --skip-editable --ignore-vuln PYSEC-2024-277 --ignore-vuln PYSEC-2026-89 --ignore-vuln PYSEC-2026-97