From 7928100c84713037761a0e4d5ba74e9e54240651 Mon Sep 17 00:00:00 2001 From: Theoreticallyhugo Date: Mon, 30 Mar 2026 17:22:31 +0200 Subject: [PATCH 1/2] replace pre-commit with prek --- .github/workflows/code_quality_and_tests.yml | 20 ++--- Makefile | 4 +- README.md | 8 +- pyproject.toml | 4 +- uv.lock | 85 +++++--------------- 5 files changed, 39 insertions(+), 82 deletions(-) diff --git a/.github/workflows/code_quality_and_tests.yml b/.github/workflows/code_quality_and_tests.yml index 2f9b4f257..748d2db3c 100644 --- a/.github/workflows/code_quality_and_tests.yml +++ b/.github/workflows/code_quality_and_tests.yml @@ -10,7 +10,7 @@ env: FORCE_COLOR: "1" jobs: - pre-commit: + prek: name: Code quality checks runs-on: "ubuntu-latest" steps: @@ -21,8 +21,8 @@ jobs: with: os: "ubuntu-latest" python: "3.10" - - name: Compute pre-commit cache key - id: pre-commit-cache + - name: Compute prek cache key + id: prek-cache shell: python run: | import hashlib @@ -31,18 +31,18 @@ jobs: python = "py{}.{}".format(*sys.version_info[:2]) payload = sys.version.encode() + sys.executable.encode() digest = hashlib.sha256(payload).hexdigest() - result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8]) + result = "${{ runner.os }}-{}-{}-prek".format(python, digest[:8]) with open(os.environ['GITHUB_OUTPUT'], 'a') as f: f.write(f"result={result}\n") - - name: Restore pre-commit cache + - name: Restore prek cache uses: actions/cache@v4 with: - path: ~/.cache/pre-commit - key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }} + path: ~/.cache/prek + key: ${{ steps.prek-cache.outputs.result }}-${{ hashFiles('.prek-config.yaml') }} restore-keys: | - ${{ steps.pre-commit-cache.outputs.result }}- - - name: Run pre-commits + ${{ steps.prek-cache.outputs.result }}- + - name: Run preks run: | - uv run --group cicd pre-commit run -a + uv run --group cicd prek run -a shell: bash pytest: name: Tests with Python ${{ matrix.python }} / ${{ matrix.os }} diff --git a/Makefile b/Makefile index 9eb8e0fa6..1a2715ce8 100644 --- a/Makefile +++ b/Makefile @@ -24,10 +24,10 @@ clean: find . -type d -name "__pycache__" -delete -## code quality checks and fixes via pre-commit +## code quality checks and fixes via prek .PHONY: precommit precommit: - poetry run pre-commit run --all-files + poetry run prek run --all-files ## Lint using flake8, black, and isort (use `make format` to do formatting) diff --git a/README.md b/README.md index af1818059..c59809f2f 100644 --- a/README.md +++ b/README.md @@ -318,12 +318,12 @@ uv sync --group cicd To run code quality checks and static type checking, call: ```bash -uv run pre-commit run -a +uv run prek run -a # if you have not run 'uv sync --group cicd' previously, use instead -uv run --group cicd pre-commit run -a +uv run --group cicd prek run -a ``` -This runs all configured [pre-commit](https://pre-commit.com/) hooks (see [pre-commit-config.yaml](.pre-commit-config.yaml)) on all files. Some hooks may fix issues automatically, others will report issues that need to be fixed manually. +This runs all configured [prek](https://prek.j178.dev/) hooks (see [pre-commit-config.yaml](.pre-commit-config.yaml)) on all files. Some hooks may fix issues automatically, others will report issues that need to be fixed manually. To run all tests, call: @@ -336,7 +336,7 @@ uv run --group cicd pytest The following commands run on GitHub CI (see [tests.yml](.github/workflows/code_quality_and_tests.yml)), but can also be run locally: ```bash -uv run --group cicd pre-commit run -a +uv run --group cicd prek run -a # run tests *not marked as slow* with coverage and typeguard checks uv run --group cicd pytest -m "not slow" ``` diff --git a/pyproject.toml b/pyproject.toml index 3d263f08f..6e8064629 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,8 +51,8 @@ cicd = [ "pytest-xdist>=3.8.0,<4", "pytest-cov>=6.2.1,<7", "typeguard>=2.13.3", - "pre-commit>=2.16.0", "mypy>=1.3.0", + "prek>=0.3.8", ] [tool.hatch.build.targets.sdist] @@ -110,7 +110,7 @@ exclude = [".git", "notebooks", "models", "data", "logs"] skip = "logs/**,data/**,configs/**/*template*,configs/evaluate.yaml,tests/fixtures/**.json,tests/fixtures/**.jsonl,src/kibad_llm/schema/**,tests/unit/schema/**,*.ipynb" ignore-words-list = "hist" -# Bandit (read by pre-commit bandit with -c pyproject.toml) +# Bandit (read by prek bandit with -c pyproject.toml) [tool.bandit] skips = ["B101", "B107", "B403"] # optionally exclude tests to reduce noise: diff --git a/uv.lock b/uv.lock index f841daa78..3e2903b9b 100644 --- a/uv.lock +++ b/uv.lock @@ -669,15 +669,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ae/3a/dbeec9d1ee0844c679f6bb5d6ad4e9f198b1224f4e7a32825f47f6192b0c/cffi-2.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9", size = 184195, upload-time = "2025-09-08T23:23:43.004Z" }, ] -[[package]] -name = "cfgv" -version = "3.5.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/4e/b5/721b8799b04bf9afe054a3899c6cf4e880fcf8563cc71c15610242490a0c/cfgv-3.5.0.tar.gz", hash = "sha256:d5b1034354820651caa73ede66a6294d6e95c1b00acc5e9b098e917404669132", size = 7334, upload-time = "2025-11-19T20:55:51.612Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/db/3c/33bac158f8ab7f89b2e59426d5fe2e4f63f7ed25df84c036890172b412b5/cfgv-3.5.0-py2.py3-none-any.whl", hash = "sha256:a8dc6b26ad22ff227d2634a65cb388215ce6cc96bbcc5cfde7641ae87e8dacc0", size = 7445, upload-time = "2025-11-19T20:55:50.744Z" }, -] - [[package]] name = "charset-normalizer" version = "3.4.4" @@ -1381,15 +1372,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3f/27/4570e78fc0bf5ea0ca45eb1de3818a23787af9b390c0b0a0033a1b8236f9/diskcache-5.6.3-py3-none-any.whl", hash = "sha256:5e31b2d5fbad117cc363ebaf6b689474db18a1f6438bc82358b024abd4c2ca19", size = 45550, upload-time = "2023-08-31T06:11:58.822Z" }, ] -[[package]] -name = "distlib" -version = "0.4.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/96/8e/709914eb2b5749865801041647dc7f4e6d00b549cfe88b65ca192995f07c/distlib-0.4.0.tar.gz", hash = "sha256:feec40075be03a04501a973d81f633735b4b69f98b05450592310c0f401a4e0d", size = 614605, upload-time = "2025-07-17T16:52:00.465Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/33/6b/e0547afaf41bf2c42e52430072fa5658766e3d65bd4b03a563d1b6336f57/distlib-0.4.0-py2.py3-none-any.whl", hash = "sha256:9659f7d87e46584a30b5780e43ac7a2143098441670ff0a49d5f9034c54a6c16", size = 469047, upload-time = "2025-07-17T16:51:58.613Z" }, -] - [[package]] name = "distro" version = "1.9.0" @@ -2213,15 +2195,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c6/50/e0edd38dcd63fb26a8547f13d28f7a008bc4a3fd4eb4ff030673f22ad41a/hydra_core-1.3.2-py3-none-any.whl", hash = "sha256:fa0238a9e31df3373b35b0bfb672c34cc92718d21f81311d8996a16de1141d8b", size = 154547, upload-time = "2023-02-23T18:33:40.801Z" }, ] -[[package]] -name = "identify" -version = "2.6.16" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/5b/8d/e8b97e6bd3fb6fb271346f7981362f1e04d6a7463abd0de79e1fda17c067/identify-2.6.16.tar.gz", hash = "sha256:846857203b5511bbe94d5a352a48ef2359532bc8f6727b5544077a0dcfb24980", size = 99360, upload-time = "2026-01-12T18:58:58.201Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b8/58/40fbbcefeda82364720eba5cf2270f98496bdfa19ea75b4cccae79c698e6/identify-2.6.16-py2.py3-none-any.whl", hash = "sha256:391ee4d77741d994189522896270b787aed8670389bfd60f326d677d64a6dfb0", size = 99202, upload-time = "2026-01-12T18:58:56.627Z" }, -] - [[package]] name = "idna" version = "3.11" @@ -2812,7 +2785,7 @@ dependencies = [ [package.dev-dependencies] cicd = [ { name = "mypy" }, - { name = "pre-commit" }, + { name = "prek" }, { name = "pytest" }, { name = "pytest-cov" }, { name = "pytest-xdist" }, @@ -2857,7 +2830,7 @@ requires-dist = [ [package.metadata.requires-dev] cicd = [ { name = "mypy", specifier = ">=1.3.0" }, - { name = "pre-commit", specifier = ">=2.16.0" }, + { name = "prek", specifier = ">=0.3.8" }, { name = "pytest", specifier = ">=6.2.5" }, { name = "pytest-cov", specifier = ">=6.2.1,<7" }, { name = "pytest-xdist", specifier = ">=3.8.0,<4" }, @@ -4057,15 +4030,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/60/90/81ac364ef94209c100e12579629dc92bf7a709a84af32f8c551b02c07e94/nltk-3.9.2-py3-none-any.whl", hash = "sha256:1e209d2b3009110635ed9709a67a1a3e33a10f799490fa71cf4bec218c11c88a", size = 1513404, upload-time = "2025-10-01T07:19:21.648Z" }, ] -[[package]] -name = "nodeenv" -version = "1.10.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/24/bf/d1bda4f6168e0b2e9e5958945e01910052158313224ada5ce1fb2e1113b8/nodeenv-1.10.0.tar.gz", hash = "sha256:996c191ad80897d076bdfba80a41994c2b47c68e224c542b48feba42ba00f8bb", size = 55611, upload-time = "2025-12-20T14:08:54.006Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/88/b2/d0896bdcdc8d28a7fc5717c305f1a861c26e18c05047949fb371034d98bd/nodeenv-1.10.0-py2.py3-none-any.whl", hash = "sha256:5bb13e3eed2923615535339b3c620e76779af4cb4c6a90deccc9e36b274d3827", size = 23438, upload-time = "2025-12-20T14:08:52.782Z" }, -] - [[package]] name = "notebook" version = "7.5.2" @@ -4767,19 +4731,27 @@ wheels = [ ] [[package]] -name = "pre-commit" -version = "4.5.1" +name = "prek" +version = "0.3.8" source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "cfgv" }, - { name = "identify" }, - { name = "nodeenv" }, - { name = "pyyaml" }, - { name = "virtualenv" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/40/f1/6d86a29246dfd2e9b6237f0b5823717f60cad94d47ddc26afa916d21f525/pre_commit-4.5.1.tar.gz", hash = "sha256:eb545fcff725875197837263e977ea257a402056661f09dae08e4b149b030a61", size = 198232, upload-time = "2025-12-16T21:14:33.552Z" } +sdist = { url = "https://files.pythonhosted.org/packages/62/ee/03e8180e3fda9de25b6480bd15cc2bde40d573868d50648b0e527b35562f/prek-0.3.8.tar.gz", hash = "sha256:434a214256516f187a3ab15f869d950243be66b94ad47987ee4281b69643a2d9", size = 400224, upload-time = "2026-03-23T08:23:35.981Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/5d/19/fd3ef348460c80af7bb4669ea7926651d1f95c23ff2df18b9d24bab4f3fa/pre_commit-4.5.1-py2.py3-none-any.whl", hash = "sha256:3b3afd891e97337708c1674210f8eba659b52a38ea5f822ff142d10786221f77", size = 226437, upload-time = "2025-12-16T21:14:32.409Z" }, + { url = "https://files.pythonhosted.org/packages/00/84/40d2ddf362d12c4cd4a25a8c89a862edf87cdfbf1422aa41aac8e315d409/prek-0.3.8-py3-none-linux_armv6l.whl", hash = "sha256:6fb646ada60658fa6dd7771b2e0fb097f005151be222f869dada3eb26d79ed33", size = 5226646, upload-time = "2026-03-23T08:23:18.306Z" }, + { url = "https://files.pythonhosted.org/packages/e1/52/7308a033fa43b7e8e188797bd2b3b017c0f0adda70fa7af575b1f43ea888/prek-0.3.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:f3d7fdadb15efc19c09953c7a33cf2061a70f367d1e1957358d3ad5cc49d0616", size = 5620104, upload-time = "2026-03-23T08:23:40.053Z" }, + { url = "https://files.pythonhosted.org/packages/ff/b1/f106ac000a91511a9cd80169868daf2f5b693480ef5232cec5517a38a512/prek-0.3.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:72728c3295e79ca443f8c1ec037d2a5b914ec73a358f69cf1bc1964511876bf8", size = 5199867, upload-time = "2026-03-23T08:23:38.066Z" }, + { url = "https://files.pythonhosted.org/packages/b3/e9/970713f4b019f69de9844e1bab37b8ddb67558e410916f4eb5869a696165/prek-0.3.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:48efc28f2f53b5b8087efca9daaed91572d62df97d5f24a1c7a087fecb5017de", size = 5441801, upload-time = "2026-03-23T08:23:32.617Z" }, + { url = "https://files.pythonhosted.org/packages/12/a4/7ef44032b181753e19452ec3b09abb3a32607cf6b0a0508f0604becaaf2b/prek-0.3.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f6ca9d63bacbc448a5c18e955c78d3ac5176c3a17c3baacdd949b1a623e08a36", size = 5155107, upload-time = "2026-03-23T08:23:31.021Z" }, + { url = "https://files.pythonhosted.org/packages/bd/77/4d9c8985dbba84149760785dfe07093ea1e29d710257dfb7c89615e2234c/prek-0.3.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1000f7029696b4fe712fb1fefd4c55b9c4de72b65509c8e50296370a06f9dc3f", size = 5566541, upload-time = "2026-03-23T08:23:45.694Z" }, + { url = "https://files.pythonhosted.org/packages/1a/1a/81e6769ac1f7f8346d09ce2ab0b47cf06466acd9ff72e87e5d1f0d98cd32/prek-0.3.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6ff0bed0e2c1286522987d982168a86cbbd0d069d840506a46c9fda983515517", size = 6552991, upload-time = "2026-03-23T08:23:21.958Z" }, + { url = "https://files.pythonhosted.org/packages/6f/fa/ce2df0dd2dc75a9437a52463239d0782998943d7b04e191fb89b83016c34/prek-0.3.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4fb087ac0ffda3ac65bbbae9a38326a7fd27ee007bb4a94323ce1eb539d8bbec", size = 5832972, upload-time = "2026-03-23T08:23:20.258Z" }, + { url = "https://files.pythonhosted.org/packages/18/6b/9d4269df9073216d296244595a21c253b6475dfc9076c0bd2906be7a436c/prek-0.3.8-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:2e1e5e206ff7b31bd079cce525daddc96cd6bc544d20dc128921ad92f7a4c85d", size = 5448371, upload-time = "2026-03-23T08:23:41.835Z" }, + { url = "https://files.pythonhosted.org/packages/60/1d/1e4d8a78abefa5b9d086e5a9f1638a74b5e540eec8a648d9946707701f29/prek-0.3.8-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:dcea3fe23832a4481bccb7c45f55650cb233be7c805602e788bb7dba60f2d861", size = 5270546, upload-time = "2026-03-23T08:23:24.231Z" }, + { url = "https://files.pythonhosted.org/packages/77/07/34f36551a6319ae36e272bea63a42f59d41d2d47ab0d5fb00eb7b4e88e87/prek-0.3.8-py3-none-musllinux_1_1_armv7l.whl", hash = "sha256:4d25e647e9682f6818ab5c31e7a4b842993c14782a6ffcd128d22b784e0d677f", size = 5124032, upload-time = "2026-03-23T08:23:26.368Z" }, + { url = "https://files.pythonhosted.org/packages/e3/01/6d544009bb655e709993411796af77339f439526db4f3b3509c583ad8eb9/prek-0.3.8-py3-none-musllinux_1_1_i686.whl", hash = "sha256:de528b82935e33074815acff3c7c86026754d1212136295bc88fe9c43b4231d5", size = 5432245, upload-time = "2026-03-23T08:23:47.877Z" }, + { url = "https://files.pythonhosted.org/packages/54/96/1237ee269e9bfa283ffadbcba1f401f48a47aed2b2563eb1002740d6079d/prek-0.3.8-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:6d660f1c25a126e6d9f682fe61449441226514f412a4469f5d71f8f8cad56db2", size = 5950550, upload-time = "2026-03-23T08:23:43.8Z" }, + { url = "https://files.pythonhosted.org/packages/ca/6b/a574411459049bc691047c9912f375deda10c44a707b6ce98df2b658f0b3/prek-0.3.8-py3-none-win32.whl", hash = "sha256:b0c291c577615d9f8450421dff0b32bfd77a6b0d223ee4115a1f820cb636fdf1", size = 4949501, upload-time = "2026-03-23T08:23:16.338Z" }, + { url = "https://files.pythonhosted.org/packages/0c/b4/46b59fe49f635acd9f6530778ce577f9d8b49452835726a5311ffc902c67/prek-0.3.8-py3-none-win_amd64.whl", hash = "sha256:bc147fdbdd4ec33fc7a987b893ecb69b1413ac100d95c9889a70f3fd58c73d06", size = 5346551, upload-time = "2026-03-23T08:23:34.501Z" }, + { url = "https://files.pythonhosted.org/packages/53/05/9cca1708bb8c65264124eb4b04251e0f65ce5bfc707080bb6b492d5a0df7/prek-0.3.8-py3-none-win_arm64.whl", hash = "sha256:a2614647aeafa817a5802ccb9561e92eedc20dcf840639a1b00826e2c2442515", size = 5190872, upload-time = "2026-03-23T08:23:29.463Z" }, ] [[package]] @@ -7466,21 +7438,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e4/16/c1fd27e9549f3c4baf1dc9c20c456cd2f822dbf8de9f463824b0c0357e06/uvloop-0.22.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6cde23eeda1a25c75b2e07d39970f3374105d5eafbaab2a4482be82f272d5a5e", size = 4296730, upload-time = "2025-10-16T22:17:00.744Z" }, ] -[[package]] -name = "virtualenv" -version = "20.36.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "distlib" }, - { name = "filelock" }, - { name = "platformdirs" }, - { name = "typing-extensions", marker = "python_full_version < '3.11'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/aa/a3/4d310fa5f00863544e1d0f4de93bddec248499ccf97d4791bc3122c9d4f3/virtualenv-20.36.1.tar.gz", hash = "sha256:8befb5c81842c641f8ee658481e42641c68b5eab3521d8e092d18320902466ba", size = 6032239, upload-time = "2026-01-09T18:21:01.296Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6a/2a/dc2228b2888f51192c7dc766106cd475f1b768c10caaf9727659726f7391/virtualenv-20.36.1-py3-none-any.whl", hash = "sha256:575a8d6b124ef88f6f51d56d656132389f961062a9177016a50e4f507bbcc19f", size = 6008258, upload-time = "2026-01-09T18:20:59.425Z" }, -] - [[package]] name = "vllm" version = "0.12.0" From 61660a1535ff29e7d9130a6ba427c7cb9cd2298c Mon Sep 17 00:00:00 2001 From: Theoreticallyhugo Date: Mon, 30 Mar 2026 17:52:10 +0200 Subject: [PATCH 2/2] add priorities for simultaneous execution --- .pre-commit-config.yaml | 65 ++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index faf6b66c0..02ef9cdaa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,6 @@ +# priorieties are like stages at which hooks run. +# hooks using the same priority run simultaneously. +# hooks running simultaneously may run into conflicts when operating on/ changing the same files! exclude: "^data/.*|^tests/fixtures/.*" repos: @@ -6,27 +9,39 @@ repos: rev: v6.0.0 hooks: - id: trailing-whitespace + priority: 00 - id: end-of-file-fixer + priority: 01 - id: check-docstring-first + priority: 02 - id: check-yaml + priority: 03 - id: debug-statements + priority: 04 - id: detect-private-key + priority: 05 - id: check-executables-have-shebangs + priority: 06 - id: check-toml + priority: 07 - id: check-case-conflict + priority: 08 - id: check-added-large-files + priority: 09 # Black (reads [tool.black] from pyproject.toml) - repo: https://github.com/psf/black rev: 25.9.0 hooks: - id: black + priority: 10 # isort (reads [tool.isort] from pyproject.toml) - repo: https://github.com/PyCQA/isort rev: 6.0.1 hooks: - id: isort + priority: 20 # pyupgrade (no TOML config; keep args here) - repo: https://github.com/asottile/pyupgrade @@ -34,34 +49,56 @@ repos: hooks: - id: pyupgrade args: ["--py310-plus"] + priority: 30 # Flake8 (reads [tool.flake8] via plugin) - repo: https://github.com/PyCQA/flake8 rev: 7.3.0 hooks: - id: flake8 + priority: 40 additional_dependencies: - flake8-pyproject - # Security linter (reads [tool.bandit] from pyproject.toml) - - repo: https://github.com/PyCQA/bandit - rev: "1.8.6" + # Strip Jupyter outputs + - repo: https://github.com/kynan/nbstripout + rev: 0.8.1 hooks: - - id: bandit - args: ["-c", "pyproject.toml"] # tell bandit to read pyproject - additional_dependencies: ["bandit[toml]"] # ensure TOML support + - id: nbstripout + priority: 50 + + # Run tools on notebooks via nbQA (inherits configs) + - repo: https://github.com/nbQA-dev/nbQA + rev: 1.9.1 + hooks: + - id: nbqa-black + priority: 10 # run when black runs + - id: nbqa-isort + priority: 20 # run when isort runs + - id: nbqa-flake8 + priority: 40 # run when flake8 runs # Markdown formatter (reads [tool.mdformat] via plugin) - repo: https://github.com/hukkin/mdformat rev: 0.7.22 hooks: - id: mdformat + priority: 70 # run when black runs additional_dependencies: - mdformat-gfm - mdformat-tables - mdformat_frontmatter - mdformat-pyproject + # Security linter (reads [tool.bandit] from pyproject.toml) + - repo: https://github.com/PyCQA/bandit + rev: "1.8.6" + hooks: + - id: bandit + args: ["-c", "pyproject.toml"] # tell bandit to read pyproject + additional_dependencies: ["bandit[toml]"] # ensure TOML support + priority: 80 + # Spelling checker (reads [tool.codespell] from pyproject.toml) - repo: https://github.com/codespell-project/codespell rev: v2.4.1 @@ -69,20 +106,7 @@ repos: - id: codespell # For Python < 3.11, TOML parsing needs tomli additional_dependencies: ["tomli"] - - # Strip Jupyter outputs - - repo: https://github.com/kynan/nbstripout - rev: 0.8.1 - hooks: - - id: nbstripout - - # Run tools on notebooks via nbQA (inherits configs) - - repo: https://github.com/nbQA-dev/nbQA - rev: 1.9.1 - hooks: - - id: nbqa-black - - id: nbqa-isort - - id: nbqa-flake8 + priority: 80 # run when bandit runs - repo: local hooks: @@ -91,3 +115,4 @@ repos: entry: uv run mypy --config=pyproject.toml language: system pass_filenames: false + priority: 80 # run when bandit runs