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
46 changes: 25 additions & 21 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,28 +25,31 @@ 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

validate-dependencies:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency validation gets removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it because update_python_depends.py (the script this step uses) is missing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. But we should still check that the files are the same in the Rust crate and the Python packages (ideally we'd only have one file, but both don't deal well with out-of-tree files).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something like cmp -s file1 file2 should do the trick, since it returns exit code != 0 when the files differ.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the latest changes work for you? 👀

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

- name: Set up Python
uses: actions/setup-python@v6
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"

- name: Validate python_depends.json is up-to-date
run: |
python ( cd kernels && update_python_depends.py --validate ) || {
echo "Error: python_depends.json is out of date."
echo "Please run: python update_python_depends.py"
exit 1
}
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 shared files between Rust crate and Python package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Check python_depends.json is in sync
run: cmp -s kernel-builder/src/python_dependencies.json kernels/src/kernels/python_depends.json

7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: style
.PHONY: style quality

export check_dirs := kernels/src kernels/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}
Loading