File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Post-edit hook for Python files. Runs type checking and linting/formatting.
3+ # Usage: post-edit-python.sh <file_path>
4+ # Intended to be called by AI coding agents after editing a python file.
5+ FILE_PATH=" $1 "
6+
7+ [[ " $FILE_PATH " != * .py ]] && exit 0
8+
9+ cd " $( git rev-parse --show-toplevel) "
10+ uv run ty check
11+ uv run ruff check --fix " $FILE_PATH "
12+ uv run ruff format " $FILE_PATH "
Original file line number Diff line number Diff line change 66- We use uv for everything (e.g. we do ` uv run python ... ` to run some python code, and
77 ` uv run pytest tests/unit ` to run unit tests). Please prefer ` uv run python -c ... ` over
88 ` python3 -c ... `
9- - After generating code, please run ` uv run ty check ` , ` uv run ruff check ` and ` uv run ruff format ` .
10- Fix any error.
119- After changing anything in ` src ` or in ` tests/unit ` or ` tests/doc ` , please identify the affected
1210 test files in ` tests/ ` and run them with e.g.
1311 ` uv run pytest tests/unit/aggregation/test_upgrad.py -W error ` . Fix any error, either in the
You can’t perform that action at this time.
0 commit comments