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
31 changes: 22 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Lints
name: Styling and lints
on: [push, pull_request]

jobs:
lint:
name: Run lints
Expand All @@ -8,8 +9,8 @@ jobs:
- uses: actions/checkout@v6
- name: Run ruff
uses: astral-sh/ruff-action@v3
src: >-
kernels
with:
src: kernels/src kernels/tests

black:
name: Run black check
Expand All @@ -24,12 +25,24 @@ jobs:
with:
python-version: 3.12

- name: Install black
run: uv pip install black

- name: Check formatting
run: |
uv run black --check kernels
run: uv run --with black black --check kernels/src kernels/tests

isort:
name: Run isort check
runs-on: ubuntu-latest
env:
UV_PYTHON_PREFERENCE: only-managed
steps:
- uses: actions/checkout@v6

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
python-version: 3.12

- name: Check import sorting
run: uv run --with isort isort --check-only --diff kernels/src kernels/tests

validate-dependencies:
name: Validate python_depends.json
Expand All @@ -44,7 +57,7 @@ jobs:

- name: Validate python_depends.json is up-to-date
run: |
python ( cd kernels && update_python_depends.py --validate ) || {
(cd kernels && python update_python_depends.py --validate) || {
echo "Error: python_depends.json is out of date."
echo "Please run: python update_python_depends.py"
exit 1
Expand Down
7 changes: 6 additions & 1 deletion kernels/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: style
.PHONY: style quality

export check_dirs := src tests

Expand All @@ -11,3 +11,8 @@ style:
black ${check_dirs}
isort ${check_dirs}
ruff check ${check_dirs} --fix

quality:
black --check ${check_dirs}
isort --check-only --diff ${check_dirs}
ruff check ${check_dirs}
1 change: 0 additions & 1 deletion kernels/tests/test_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def __init__(self):

def forward(self, input: torch.Tensor) -> torch.Tensor:
self.n_calls += 1
_ = input.shape[-1] // 2
return F.relu(input)


Expand Down
Loading