diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e433eb8c..489aa01a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,6 @@ -name: Lints +name: Styling and lints on: [push, pull_request] + jobs: lint: name: Run lints @@ -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 @@ -24,28 +25,22 @@ 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: - 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 + diff --git a/kernels/Makefile b/kernels/Makefile index 7d6b214c..1eea7060 100644 --- a/kernels/Makefile +++ b/kernels/Makefile @@ -1,4 +1,4 @@ -.PHONY: style +.PHONY: style quality export check_dirs := src tests @@ -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} diff --git a/kernels/tests/test_tvm_ffi.py b/kernels/tests/test_tvm_ffi.py index faa4deb2..abc5cd82 100644 --- a/kernels/tests/test_tvm_ffi.py +++ b/kernels/tests/test_tvm_ffi.py @@ -1,7 +1,6 @@ import pytest -from kernels import get_kernel, install_kernel, get_local_kernel - +from kernels import get_kernel, get_local_kernel, install_kernel relu_supported_devices = ["cpu", "cuda", "xpu"]