From e04767e39ecc9d494284b259cb65a168d2351e6e Mon Sep 17 00:00:00 2001 From: chenyu Date: Tue, 20 Jan 2026 12:24:33 -0500 Subject: [PATCH] run pre-commit in ci (#14253) * run pre-commit in ci prevents pre-commit regression * IGNORE_OOB=1 * pytest * unit test * split --- .github/workflows/test.yml | 14 ++++++++------ pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09d320215f..e017ab0702 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -229,14 +229,14 @@ jobs: deps: linting - name: Lint bad-indentation and trailing-whitespace with pylint run: python -m pylint --disable=all -e W0311 -e C0303 --jobs=0 --indent-string=' ' --recursive=y . - - name: Lint with ruff + - name: Run pre-commit linting hooks + run: SKIP=tiny,tests,example pre-commit run --all-files + - name: Lint additional files with ruff run: | - pip3 install --upgrade --force-reinstall ruff==0.14.10 - pre-commit run ruff --all-files python3 -m ruff check examples/mlperf/ --ignore E501 python3 -m ruff check extra/thunder/tiny/ --ignore E501 --ignore F841 --ignore E722 python3 -m ruff check extra/torch_backend/backend.py - - name: Run mypy + - name: Run mypy with lineprecision report run: | python -m mypy --lineprecision-report . cat lineprecision.txt @@ -254,10 +254,12 @@ jobs: - name: Setup Environment uses: ./.github/actions/setup-tinygrad with: - key: unittest-12 - pydeps: "pillow numpy ftfy regex" + key: unittest-13 + pydeps: "pillow numpy ftfy regex pre-commit" deps: testing_unit llvm: 'true' + - name: Run pre-commit test hooks + run: SKIP=ruff,mypy pre-commit run --all-files - name: Check Device.DEFAULT run: python -c "from tinygrad import Device; assert Device.DEFAULT == 'CPU', Device.DEFAULT" - name: Run unit tests diff --git a/pyproject.toml b/pyproject.toml index 2e9ce945a8..80f40fde2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ linting = [ "mypy==1.19.1", "typing-extensions", "pre-commit", - "ruff", + "ruff==0.14.10", "numpy", "typeguard", ]