From b8fffe6058e23aab351f53ec9cf4aa0d996acb9b Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Mon, 23 Nov 2026 10:02:49 -0800 Subject: [PATCH] chore(dev): replace pre-commit with prek pre-commit pulls virtualenv and its command-injection advisories into the dev lock. prek is pre-commit-compatible and manages hook environments with uv, so virtualenv and its transitive dependencies drop out entirely. --- .github/workflows/ci.yaml | 14 ++--- .pre-commit-config.yaml | 3 +- devenv/sync.py | 4 +- pyproject.toml | 2 +- uv.lock | 107 +++++--------------------------------- 5 files changed, 23 insertions(+), 107 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 042ded63..b2e9c33e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -40,7 +40,7 @@ jobs: with: go-version: stable - # this is way too slow to add to pre-commit + # this is way too slow to add to prek - run: go mod tidy - run: go install golang.org/x/tools/cmd/goimports@v0.36.0 @@ -51,7 +51,7 @@ jobs: version: v2.14 install-mode: binary # we're just using their official action to install; - # running should be consolidated into pre-commit + # running should be consolidated into prek args: "--help" - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 @@ -67,14 +67,14 @@ jobs: - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: - path: ~/.cache/pre-commit + path: ~/.cache/prek key: cache-epoch-1|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml', 'uv.lock') }} - - name: Install pre-commit - run: pre-commit install-hooks + - name: Install prek + run: .venv/bin/prek prepare-hooks - - name: Run pre-commit - run: pre-commit run --all-files + - name: Run prek + run: .venv/bin/prek run --all-files test-vroom: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 851a5124..962d70a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,8 +14,7 @@ repos: types: [go] pass_filenames: false - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + - repo: builtin hooks: - id: check-case-conflict - id: check-executables-have-shebangs diff --git a/devenv/sync.py b/devenv/sync.py index c3b07aa3..ff3a9b90 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -28,7 +28,7 @@ def main(context: dict[str, str]) -> int: (f"{reporoot}/.devenv/bin/uv", "sync", "--frozen", "--quiet", "--active"), ) - print("installing pre-commit hooks ...") - proc.run((f"{reporoot}/.venv/bin/pre-commit", "install", "--install-hooks")) + print("installing prek hooks ...") + proc.run((f"{reporoot}/.venv/bin/prek", "install", "--prepare-hooks", "-f")) return 0 diff --git a/pyproject.toml b/pyproject.toml index a3364396..d6122817 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ version = "0.0.0" [dependency-groups] dev = [ "devservices>=1.2.1", - "pre-commit>=4.2.0", + "prek>=0.5.10", "sentry-devenv>=1.22.2", ] diff --git a/uv.lock b/uv.lock index 64f261ff..7c9052d0 100644 --- a/uv.lock +++ b/uv.lock @@ -17,15 +17,6 @@ wheels = [ { url = "https://sfw.security.sentry.io/pypi/packages/c4/51/29046e48f693c54e5b7412216d447a1d8362c9653148d98c02cdf65fa733/certifi-2026.10.19-py3-none-any.whl", hash = "sha256:42d35340cc5b9ba78e818ddbff0c5b1c2b779de448a340fd1b989f5fa8670e1b", size = 136464, upload-time = "2026-10-20T02:24:15.072Z" }, ] -[[package]] -name = "cfgv" -version = "3.4.0" -source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/11/74/539e56497d9bd1d484fd863dd69cbbfa653cd2aa27abfe35653494d85e94/cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560", size = 7114, upload-time = "2023-08-12T20:38:17.776Z" } -wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/c5/55/51844dd50c4fc7a33b653bfaba4c2456f06955289ca770a5dbd5fd267374/cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9", size = 7249, upload-time = "2023-08-12T20:38:16.269Z" }, -] - [[package]] name = "devservices" version = "1.2.1" @@ -42,42 +33,6 @@ wheels = [ { url = "https://sfw.security.sentry.io/pypi/packages/9a/75/c86ee956404e34dcc5f4bd1e010355548390dfe5d979d633577cf4770ff9/devservices-1.2.1-py3-none-any.whl", hash = "sha256:7c76ab711550cd1f42bd99b12edfcbdb1792fb7df0b7fec51eb13a2e2ff5df1b", size = 116668, upload-time = "2025-06-17T21:16:43.264Z" }, ] -[[package]] -name = "distlib" -version = "0.4.4" -source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/68/bc/d36966de7304047a1001a7559fbf266c464bb5d8cc85464536ef8c9bcc32/distlib-0.4.4.tar.gz", hash = "sha256:ca4175b4ac7f71223cc30ed7248c45d2b38c2439d8ee6e498ab67ed63cf3508d", size = 621304, upload-time = "2026-10-16T13:56:34.203Z" } -wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/c1/2b/238f02a4927fa2e27aa995371d240a468b52e42eae44a678434aff736b38/distlib-0.4.4-py2.py3-none-any.whl", hash = "sha256:cf09d55b1e85a89576b036aeb71550bfd68320f3f21761ca329eadadad918638", size = 472099, upload-time = "2026-10-16T13:56:32.053Z" }, -] - -[[package]] -name = "filelock" -version = "4.2.1" -source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/d5/98/771d8ca889f220d7d7e352addf500666368f0fd081c6080a83767580c6e4/filelock-4.2.1.tar.gz", hash = "sha256:c4c937ccac2a813cee448e662a56366cfb374c0f8702e75f295c412cc1c5d5a3", size = 650997, upload-time = "2026-10-17T16:48:14.435Z" } -wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/28/00/db89d339bc4ecdc8087fa7b8607ba22ffc27bf96286f340c9620bea428b3/filelock-4.2.1-py3-none-any.whl", hash = "sha256:7be2662e9e826b9bba28afc0f843a123280d799a2ea44bb5d35ccec67905ae44", size = 162455, upload-time = "2026-10-17T16:48:12.937Z" }, -] - -[[package]] -name = "identify" -version = "2.6.9" -source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/9b/98/a71ab060daec766acc30fb47dfca219d03de34a70d616a79a38c6066c5bf/identify-2.6.9.tar.gz", hash = "sha256:d40dfe3142a1421d8518e3d3985ef5ac42890683e32306ad614a29490abeb6bf", size = 99249, upload-time = "2025-03-08T15:54:13.632Z" } -wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/07/ce/0845144ed1f0e25db5e7a79c2354c1da4b5ce392b8966449d5db8dca18f1/identify-2.6.9-py2.py3-none-any.whl", hash = "sha256:c98b4322da415a8e5a70ff6e51fbc2d2932c015532d77e9f8537b4ba7813b150", size = 99101, upload-time = "2025-03-08T15:54:12.026Z" }, -] - -[[package]] -name = "nodeenv" -version = "1.9.1" -source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/43/16/fc88b08840de0e0a72a2f9d8c6bae36be573e475a6326ae854bcc549fc45/nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f", size = 47437, upload-time = "2024-06-04T18:44:11.171Z" } -wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/d2/1d/1b658dbd2b9fa9c4c9f32accbfc0205d532c8c6194dc0f2a4c0428e7128a/nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9", size = 22314, upload-time = "2024-06-04T18:44:08.352Z" }, -] - [[package]] name = "packaging" version = "26.3" @@ -88,40 +43,18 @@ wheels = [ ] [[package]] -name = "platformdirs" -version = "4.13.5" -source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/58/e6/d0abbb256b44e6a05748c6942511ff67db8dbb068de0c35b24bf1b395b09/platformdirs-4.13.5.tar.gz", hash = "sha256:05831adf87d392760f4b5c3a0a95579ab5a10b18b9b9bd43680dcb47544788a0", size = 62362, upload-time = "2026-10-19T01:02:11.778Z" } -wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/6c/8a/1d8cb3842909dc193a73835adedf412e32e18f8ffd59f43983949622fe6f/platformdirs-4.13.5-py3-none-any.whl", hash = "sha256:53d3ec4280b815c1e0b02edad7f9ee8fda1ba9c0865dd9c2e6e63849ce82fc1e", size = 32779, upload-time = "2026-10-19T01:02:10.17Z" }, -] - -[[package]] -name = "pre-commit" -version = "4.2.0" -source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -dependencies = [ - { name = "cfgv" }, - { name = "identify" }, - { name = "nodeenv" }, - { name = "pyyaml" }, - { name = "virtualenv" }, -] -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/08/39/679ca9b26c7bb2999ff122d50faa301e49af82ca9c066ec061cfbc0c6784/pre_commit-4.2.0.tar.gz", hash = "sha256:601283b9757afd87d40c4c4a9b2b5de9637a8ea02eaff7adc2d0fb4e04841146", size = 193424, upload-time = "2025-03-18T21:35:20.987Z" } -wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/88/74/a88bf1b1efeae488a0c0b7bdf71429c313722d1fc0f377537fbe554e6180/pre_commit-4.2.0-py2.py3-none-any.whl", hash = "sha256:a009ca7205f1eb497d10b845e52c838a98b6cdd2102a6c8e4540e94ee75c58bd", size = 220707, upload-time = "2025-03-18T21:35:19.343Z" }, -] - -[[package]] -name = "python-discovery" -version = "1.6.1" +name = "prek" +version = "0.5.11" source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -dependencies = [ - { name = "filelock" }, -] -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/0c/57/250bd238b966cece44328235eb85290045d059265fdaf7527a3a958123db/python_discovery-1.6.1.tar.gz", hash = "sha256:cf87d3627dfb4412437fdd5b13eae402607722998d21567993aedbc59b23c15e", size = 84338, upload-time = "2026-09-18T01:31:53.971Z" } +sdist = { url = "https://sfw.security.sentry.io/pypi/packages/19/0d/8f661ef91334d8afe883a51f586628bb0a18c5077b39dc7c2754bc5335da/prek-0.5.11.tar.gz", hash = "sha256:99c8363ca07b881dc49cf71eb3c362670c95d0d554fc375ceee0245548081829", size = 619436, upload-time = "2026-11-16T06:42:02.693Z" } wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/16/7d/e9ffbadfbf89c93848412d04594135c4ae8c1d37d9e053b9c3ed718fabc4/python_discovery-1.6.1-py3-none-any.whl", hash = "sha256:d43fcdef879fe795352bd13ccf8d185ba5a9f86f36cfcd00529f596e737442b3", size = 38664, upload-time = "2026-09-18T01:31:52.448Z" }, + { url = "https://sfw.security.sentry.io/pypi/packages/26/33/b56b4898fe9a81e250d31e39cce0ae5705ee07609aa5f013cd22cfd781bc/prek-0.5.11-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:95da482d8f1d3323beea219e95b6bbe31a27d3b14943148d3c4eac94e9f7d7ee", size = 5916762, upload-time = "2026-11-16T06:41:46.081Z" }, + { url = "https://sfw.security.sentry.io/pypi/packages/ad/24/ef97844954e5a89c79de675d22fad0aa549db21c32226dde4a12eef5da6b/prek-0.5.11-py3-none-macosx_11_0_arm64.whl", hash = "sha256:2e530bd4c8975c6ac6eae20c70fa54c50714d56279040cc3c2b0bce279c0c84e", size = 5565126, upload-time = "2026-11-16T06:41:48.031Z" }, + { url = "https://sfw.security.sentry.io/pypi/packages/15/53/57e487d315e1fe7b1b11b1df01233f3c9cda14502f61ba76c34991d80358/prek-0.5.11-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:1cce91fe6524e1b2dfc4e5f40353caa0b62e2db9ae4b2bab314958027663a712", size = 5699656, upload-time = "2026-11-16T06:41:49.768Z" }, + { url = "https://sfw.security.sentry.io/pypi/packages/19/25/96988fbaf7bb960028fc4161ed734d0950bfda720c37206b3c6d07e044c4/prek-0.5.11-py3-none-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:c343b4e40e5aa5851fd0526c49ad8f52c4c688cde848fa95f57db91c15c67215", size = 6130515, upload-time = "2026-11-16T06:41:51.727Z" }, + { url = "https://sfw.security.sentry.io/pypi/packages/02/f0/35e94ecd6eab935705e68cfb33af06d27db4693a49214171a9adfcecb756/prek-0.5.11-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ca78936abfb2793ba9d6b9b4ac0e4eb13189bcfabd16d94c29aa573963bac87f", size = 5991609, upload-time = "2026-11-16T06:41:53.625Z" }, + { url = "https://sfw.security.sentry.io/pypi/packages/f9/44/a63b178a08d5bca1f4cfdef7305344195015fb6d5ff19be514b3a8a24f52/prek-0.5.11-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:c90b274d8eb35f28d6b70907b9d757072e20dccde1bdb7d19eeb85aac9c37ee3", size = 5682010, upload-time = "2026-11-16T06:41:55.592Z" }, + { url = "https://sfw.security.sentry.io/pypi/packages/f2/d6/0c8f2770bf03408e6c35ebea6e858d2f33d0e4037562a8f6092f73fd4223/prek-0.5.11-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:e5cbd96ed40c04a7909d98a9b8cd1d38e8e63d52e97932f09e1733b9f51bd6ac", size = 6146351, upload-time = "2026-11-16T06:41:57.479Z" }, ] [[package]] @@ -192,22 +125,6 @@ wheels = [ { url = "https://sfw.security.sentry.io/pypi/packages/92/9d/c4e665119135114480843e7ab388fa94d8480650450e6f8e26b70d323a4c/urllib3-2.8.0-py3-none-any.whl", hash = "sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3", size = 135717, upload-time = "2026-09-15T19:29:34.577Z" }, ] -[[package]] -name = "virtualenv" -version = "21.14.13" -source = { registry = "https://sfw.security.sentry.io/pypi/simple" } -dependencies = [ - { name = "distlib" }, - { name = "filelock" }, - { name = "packaging" }, - { name = "platformdirs" }, - { name = "python-discovery" }, -] -sdist = { url = "https://sfw.security.sentry.io/pypi/packages/70/aa/bff50daee0488e16d611258a9b6c5a1d0c9e128f8ca424e9f4e1c0444ef2/virtualenv-21.14.13.tar.gz", hash = "sha256:de5307ba4b9a0001d9c8ea02832d38f63ca432880f416c1bface61c4323fd905", size = 5570301, upload-time = "2026-10-22T20:10:16.952Z" } -wheels = [ - { url = "https://sfw.security.sentry.io/pypi/packages/bb/a9/c10d8a44a29fb94a18b43fdf11f38caca53ae7c9406f11a72b1cb8f624f1/virtualenv-21.14.13-py3-none-any.whl", hash = "sha256:5fbb04138a4861580b78ba9110d529a26bc48fcc93c8ec36bc0202eeed96a788", size = 5557094, upload-time = "2026-10-22T20:10:15.096Z" }, -] - [[package]] name = "vroom" version = "0.0.0" @@ -216,7 +133,7 @@ source = { virtual = "." } [package.dev-dependencies] dev = [ { name = "devservices" }, - { name = "pre-commit" }, + { name = "prek" }, { name = "sentry-devenv" }, ] @@ -225,6 +142,6 @@ dev = [ [package.metadata.requires-dev] dev = [ { name = "devservices", specifier = ">=1.2.1" }, - { name = "pre-commit", specifier = ">=4.2.0" }, + { name = "prek", specifier = ">=0.5.10" }, { name = "sentry-devenv", specifier = ">=1.22.2" }, ]