Skip to content
Open
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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 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: 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: uv run mypy --config-file pyproject.toml
language: system
pass_filenames: true
types: [python]
Expand All @@ -30,7 +30,7 @@ repos:
name: pip-audit
# Keep this ignore list in sync with .github/workflows/vulnerability-scan.yml.
entry: >-
bash -c 'source .venv/bin/activate && uv run pip-audit --skip-editable
uv run pip-audit --skip-editable
--ignore-vuln PYSEC-2024-277
--ignore-vuln PYSEC-2026-89
--ignore-vuln PYSEC-2026-97
Expand All @@ -57,7 +57,7 @@ repos:
--ignore-vuln PYSEC-2025-216
--ignore-vuln PYSEC-2025-217
--ignore-vuln PYSEC-2025-218
--ignore-vuln GHSA-f4j7-r4q5-qw2c' --
--ignore-vuln GHSA-f4j7-r4q5-qw2c
language: system
pass_filenames: false
stages: [pre-push, manual]
Expand Down
25 changes: 25 additions & 0 deletions lib/crewai/tests/test_pre_commit_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Tests for the repository's local pre-commit hooks."""

from pathlib import Path

import yaml


def test_local_hooks_use_uv_without_shell_activation() -> None:
"""Local hooks should work on Windows as well as Unix-like systems."""
root = Path(__file__).resolve().parents[3]
config = yaml.safe_load(
(root / ".pre-commit-config.yaml").read_text(encoding="utf-8")
)

local_hooks = [
hook
for repository in config["repos"]
if repository["repo"] == "local"
for hook in repository["hooks"]
if "entry" in hook
]

assert local_hooks
assert all(hook["entry"].startswith("uv run ") for hook in local_hooks)
assert all(".venv/bin/activate" not in hook["entry"] for hook in local_hooks)