Skip to content
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
22 changes: 7 additions & 15 deletions .github/workflows/ruff.yml → .github/workflows/prek.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Code Quality Checks
name: Prek

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

Expand All @@ -28,17 +27,10 @@ jobs:
run: |
uv sync --all-extras

- name: Run code quality checks
- name: Run prek hooks (lint, format, typecheck, uv.lock, tests)
run: |
uv run prek run --all-files

- name: Run unit tests (via prek)
run: |
./scripts/run_checks.sh --verbose-test-failure || {
echo ""
echo "❌ Code quality checks failed!"
echo ""
echo "To fix these issues locally, run:"
echo " ./scripts/run_checks.sh --fix"
echo ""
echo "Then commit and push the changes."
echo ""
echo "For more details, see CONTRIBUTING.md"
exit 1
}
uv run prek run pytest
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.1
hooks:
- id: ruff
- id: ruff-format

- repo: local
hooks:
- id: pyright
name: Pyright type checking
entry: uv run pyright src tests
language: system
pass_filenames: false

- id: uv-lock-check
name: uv.lock sync check
entry: uv lock --check
language: system
pass_filenames: false

- id: pytest
name: Unit tests (manual)
entry: uv run pytest --nbval --current-env --tb=short tests/unit
language: system
pass_filenames: false
stages: [manual]
2 changes: 1 addition & 1 deletion AGENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This project uses the `uv` package manager.

## Testing

- Always run tests before committing. The test command is `./scripts/run_checks.sh`.
- Always run tests before committing. The test command is `uv run prek run --all-files`.

## Releases

Expand Down
28 changes: 16 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,32 @@ cd ART
Install the dependencies:

```bash
uv sync
uv sync --group dev
```

### Code Formatting and Linting
### Code Quality Checks (prek)

This project uses [ruff](https://github.com/astral-sh/ruff) for both code formatting and linting. Before submitting a pull request, please ensure your code passes all quality checks:
This project uses [prek](https://github.com/j178/prek) to run local checks (ruff, pyright, uv.lock sync, and unit tests). Before submitting a pull request, please ensure your code passes all quality checks:

```bash
# Run all code quality checks (formatting, linting, and dependency sync)
./scripts/run_checks.sh
# Install git hooks (optional but recommended)
uv run prek install

# Automatically fix any issues that can be fixed
./scripts/run_checks.sh --fix
# Run all checks against all files (formatting, linting, typecheck, uv.lock, tests)
uv run prek run --all-files
```

The `run_checks.sh` script will:
You can also run individual hooks:

1. Check code formatting with ruff
2. Check for linting issues with ruff
3. Verify that `uv.lock` is in sync with `pyproject.toml`
```bash
uv run prek run ruff
uv run prek run ruff-format
uv run prek run pyright
uv run prek run uv-lock-check
uv run prek run pytest
```

These checks are automatically run in CI for all pull requests. If your PR fails these checks, simply run `./scripts/run_checks.sh --fix` locally and commit the changes.
These checks are automatically run in CI for all pull requests. If your PR fails these checks, re-run the corresponding `prek` hook locally and commit any fixes.

### Release Process

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ dev = [
"pytest-asyncio>=1.1.0",
"duckdb>=1.0.0",
"pyarrow>=15.0.0",
"prek>=0.2.29",
]

[tool.uv.sources]
Expand Down
Loading