This is an automated email from the ASF dual-hosted git repository.
skrawcz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hamilton.git
The following commit(s) were added to refs/heads/main by this push:
new dd2fdd63 Replace `pre-commit` with `prek` (#1453)
dd2fdd63 is described below
commit dd2fdd63c6be8fb0fde91ccb2c15813810f82334
Author: Dev-iL <[email protected]>
AuthorDate: Thu Feb 5 08:19:09 2026 +0200
Replace `pre-commit` with `prek` (#1453)
We're replacing this with prek as it's more modern.
---
.github/workflows/hamilton-main.yml | 6 +++---
.pre-commit-config.yaml | 8 ++++----
dev_tools/language_server/pyproject.toml | 2 +-
docs/how-tos/pre-commit-hooks.md | 12 ++++++------
pyproject.toml | 4 ++--
ui/sdk/.github/workflows/unit-tests.yml | 2 +-
ui/sdk/.pre-commit-config.yaml | 10 +++++-----
ui/sdk/developer_setup.md | 8 ++++----
ui/sdk/requirements-dev.txt | 2 +-
writeups/developer_setup.md | 10 +++++-----
10 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/.github/workflows/hamilton-main.yml
b/.github/workflows/hamilton-main.yml
index bbfb79da..dcb9f868 100644
--- a/.github/workflows/hamilton-main.yml
+++ b/.github/workflows/hamilton-main.yml
@@ -60,12 +60,12 @@ jobs:
activate-environment: true
# It's enough to do it on single OS
- - name: Check linting with pre-commit
+ - name: Check linting with prek
if: ${{ runner.os == 'Linux' }}
run: |
uv sync --dev
- uv run pre-commit install
- uv run pre-commit run --all-files
+ uv run prek install
+ uv run prek run --all-files
- name: Check for missing Apache 2 license headers
if: ${{ runner.os == 'Linux' }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ec7978d9..75fbc446 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,8 +1,8 @@
-# pre-commit hooks require a user to have installed `pre-commit`:
-# $ brew install pre-commit
+# pre-commit hooks require a user to have installed `prek`:
+# $ brew install prek
# Then install the hooks within the repo:
# $ cd /PATH/TO/REPO
-# $ pre-commit install
+# $ prek install
exclude: '^docs/code-comparisons/' # skip the code comparisons directory
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
@@ -16,7 +16,7 @@ repos:
- id: ruff-format
# args: [ --diff ] # Use for previewing changes
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.6.0
+ rev: v6.0.0
hooks:
- id: trailing-whitespace
# ensures files are either empty or end with a blank line
diff --git a/dev_tools/language_server/pyproject.toml
b/dev_tools/language_server/pyproject.toml
index 7ff50959..c319b213 100644
--- a/dev_tools/language_server/pyproject.toml
+++ b/dev_tools/language_server/pyproject.toml
@@ -40,7 +40,7 @@ dependencies = [
[project.optional-dependencies]
test = [
- "pre-commit",
+ "prek",
"pytest",
]
diff --git a/docs/how-tos/pre-commit-hooks.md b/docs/how-tos/pre-commit-hooks.md
index 7c620f6b..2f61a1b6 100644
--- a/docs/how-tos/pre-commit-hooks.md
+++ b/docs/how-tos/pre-commit-hooks.md
@@ -30,12 +30,12 @@ Note that it's different from testing, which focuses on the
behavior of the code
## Add pre-commit hooks to your project
Hooks are a mechanism of the `git` version control system. You can find your
project's hooks under the `.git/hooks` directory (it might be hidden by
default). There should be many files with the `.sample` extension that serve as
example scripts.
-The preferred way of working with pre-commit hooks is through the
[pre-commit](https://pre-commit.com/) Python library. This library allows you
to import and configure hooks for your repository with a
`.pre-commit-config.yaml` file.
+The preferred way of working with pre-commit hooks is through the
[prek](https://github.com/j178/prek/) library. This library allows you to
import and configure hooks for your repository with a `.pre-commit-config.yaml`
file.
### Steps to get started
-1. install the pre-commit library
+1. install the prek library
```python
- pip install pre-commit
+ pip install prek
```
2. add a `.pre-commit-config.yaml` to your repository
@@ -44,7 +44,7 @@ The preferred way of working with pre-commit hooks is through
the [pre-commit](h
repos:
# repository with hook definitions
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v2.3.0 # release version of the repo
+ rev: v6.0.0 # release version of the repo
hooks: # list of hooks from the repo to include in this project
- id: end-of-file-fixer
- id: trailing-whitespace
@@ -60,13 +60,13 @@ The preferred way of working with pre-commit hooks is
through the [pre-commit](h
3. install the hooks defined in `.pre-commit-config.yaml`
```console
- pre-commit install
+ prek install
```
Now, hooks will automatically run on `git commit`
4. to manually run hooks
```console
- pre-commit run --all-files
+ prek run --all-files
```
## Custom Apache Hamilton pre-commit hooks
diff --git a/pyproject.toml b/pyproject.toml
index 5e32e622..9c3f5d84 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -90,7 +90,7 @@ visualization = ["graphviz", "networkx"]
[dependency-groups]
dev = [
- "pre-commit",
+ "prek",
"ruff==0.5.7", # this should match `.pre-commit-config.yaml`
]
test = [
@@ -157,7 +157,7 @@ docs = [
"pyarrow >= 1.0.0",
"pydantic >=2.0",
"pyspark",
- "openlineage-python",
+ "openlineage-python",
"PyYAML",
"ray",
"readthedocs-sphinx-ext<2.3", # read the docs pins
diff --git a/ui/sdk/.github/workflows/unit-tests.yml
b/ui/sdk/.github/workflows/unit-tests.yml
index 02b97f1b..773c4eec 100644
--- a/ui/sdk/.github/workflows/unit-tests.yml
+++ b/ui/sdk/.github/workflows/unit-tests.yml
@@ -28,7 +28,7 @@ jobs:
python -m pip install -r requirements-dev.txt
- name: Run pre-commit hooks
run: |
- pre-commit run --all-files
+ prek run --all-files
- name: Test with pytest
run: |
pip install -r requirements-test.txt
diff --git a/ui/sdk/.pre-commit-config.yaml b/ui/sdk/.pre-commit-config.yaml
index 6cddba38..2bbda50f 100644
--- a/ui/sdk/.pre-commit-config.yaml
+++ b/ui/sdk/.pre-commit-config.yaml
@@ -1,8 +1,8 @@
-# pre-commit hooks require a user to have installed `pre-commit`:
-# $ brew install pre-commit
+# pre-commit hooks require a user to have installed `prek`:
+# $ brew install prek
# Then install the hooks within the repo:
# $ cd /PATH/TO/REPO
-# $ pre-commit install
+# $ prek install
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
@@ -12,12 +12,12 @@ repos:
- id: ruff
args: [ --fix , --exit-non-zero-on-fix ]
- repo: https://github.com/ambv/black
- rev: 23.3.0
+ rev: 26.1.0
hooks:
- id: black
args: [--line-length=100]
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.4.0
+ rev: v6.0.0
hooks:
- id: trailing-whitespace
# ensures files are either empty or end with a blank line
diff --git a/ui/sdk/developer_setup.md b/ui/sdk/developer_setup.md
index c71b041b..b3c712ca 100644
--- a/ui/sdk/developer_setup.md
+++ b/ui/sdk/developer_setup.md
@@ -53,10 +53,10 @@ pip install \
-r ./requirements-test.txt
```
-Set up `pre-commit`, which will run some lightweight formatting and linting
tasks on every commit.
+Set up `prek`, which will run some lightweight formatting and linting tasks on
every commit.
```shell
-pre-commit install
+prek install
```
### Create a pull request
@@ -83,10 +83,10 @@ Make changes, commit them, and push them to your fork.
git push origin HEAD
```
-Test your changes locally with `pre-commit`...
+Test your changes locally with `prek`...
```shell
-pre-commit run --all-files
+prek run --all-files
```
...and by following the steps in ["How to run unit
tests"](#how-to-run-unit-tests).
diff --git a/ui/sdk/requirements-dev.txt b/ui/sdk/requirements-dev.txt
index 02bb3068..925a9416 100644
--- a/ui/sdk/requirements-dev.txt
+++ b/ui/sdk/requirements-dev.txt
@@ -1,6 +1,6 @@
black
openapi-python-client
pandera # for cli examples
-pre-commit
+prek
ruff
scikit-learn # for cli examples
diff --git a/writeups/developer_setup.md b/writeups/developer_setup.md
index 31c60f39..2f82b228 100644
--- a/writeups/developer_setup.md
+++ b/writeups/developer_setup.md
@@ -54,10 +54,10 @@ Please be informed to use escape characters or wrap the
argument in quote as sho
pip install '.[dev,test]'
```
-Set up `pre-commit`, which will run some lightweight formatting and linting
tasks on every commit.
+Set up `prek`, which will run some lightweight formatting and linting tasks on
every commit.
```shell
-pre-commit install
+prek install
```
### Create a pull request
@@ -84,10 +84,10 @@ Make changes, commit them, and push them to your fork.
git push origin HEAD
```
-Test your changes locally with `pre-commit`...
+Test your changes locally with `prek`...
```shell
-pre-commit run --all-files
+prek run --all-files
```
...and by following the steps in ["How to run unit
tests"](#how-to-run-unit-tests).
@@ -113,7 +113,7 @@ The following values for `TASK` are recognized:
* `async` = unit tests using the async driver
* `dask` = unit tests using the `dask` adapter
* `integrations` = tests on integrations with other frameworks
-* `pre-commit` = static analysis (i.e. linting)
+* `prek` = static analysis (i.e. linting)
* `pyspark` = unit tests using the `spark` adapter
* `ray` = unit tests using the `ray` adapter
* `tests` = core unit tests with minimal requirements