Skip to content

Commit dd2fdd6

Browse files
authored
Replace pre-commit with prek (#1453)
We're replacing this with prek as it's more modern.
1 parent 9c16b63 commit dd2fdd6

10 files changed

Lines changed: 32 additions & 32 deletions

File tree

.github/workflows/hamilton-main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ jobs:
6060
activate-environment: true
6161

6262
# It's enough to do it on single OS
63-
- name: Check linting with pre-commit
63+
- name: Check linting with prek
6464
if: ${{ runner.os == 'Linux' }}
6565
run: |
6666
uv sync --dev
67-
uv run pre-commit install
68-
uv run pre-commit run --all-files
67+
uv run prek install
68+
uv run prek run --all-files
6969
7070
- name: Check for missing Apache 2 license headers
7171
if: ${{ runner.os == 'Linux' }}

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# pre-commit hooks require a user to have installed `pre-commit`:
2-
# $ brew install pre-commit
1+
# pre-commit hooks require a user to have installed `prek`:
2+
# $ brew install prek
33
# Then install the hooks within the repo:
44
# $ cd /PATH/TO/REPO
5-
# $ pre-commit install
5+
# $ prek install
66
exclude: '^docs/code-comparisons/' # skip the code comparisons directory
77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
@@ -16,7 +16,7 @@ repos:
1616
- id: ruff-format
1717
# args: [ --diff ] # Use for previewing changes
1818
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v4.6.0
19+
rev: v6.0.0
2020
hooks:
2121
- id: trailing-whitespace
2222
# ensures files are either empty or end with a blank line

dev_tools/language_server/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies = [
4040

4141
[project.optional-dependencies]
4242
test = [
43-
"pre-commit",
43+
"prek",
4444
"pytest",
4545
]
4646

docs/how-tos/pre-commit-hooks.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ Note that it's different from testing, which focuses on the behavior of the code
3030
## Add pre-commit hooks to your project
3131
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.
3232

33-
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.
33+
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.
3434

3535
### Steps to get started
36-
1. install the pre-commit library
36+
1. install the prek library
3737
```python
38-
pip install pre-commit
38+
pip install prek
3939
```
4040

4141
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
4444
repos:
4545
# repository with hook definitions
4646
- repo: https://github.com/pre-commit/pre-commit-hooks
47-
rev: v2.3.0 # release version of the repo
47+
rev: v6.0.0 # release version of the repo
4848
hooks: # list of hooks from the repo to include in this project
4949
- id: end-of-file-fixer
5050
- id: trailing-whitespace
@@ -60,13 +60,13 @@ The preferred way of working with pre-commit hooks is through the [pre-commit](h
6060

6161
3. install the hooks defined in `.pre-commit-config.yaml`
6262
```console
63-
pre-commit install
63+
prek install
6464
```
6565
Now, hooks will automatically run on `git commit`
6666

6767
4. to manually run hooks
6868
```console
69-
pre-commit run --all-files
69+
prek run --all-files
7070
```
7171

7272
## Custom Apache Hamilton pre-commit hooks

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ visualization = ["graphviz", "networkx"]
9090

9191
[dependency-groups]
9292
dev = [
93-
"pre-commit",
93+
"prek",
9494
"ruff==0.5.7", # this should match `.pre-commit-config.yaml`
9595
]
9696
test = [
@@ -157,7 +157,7 @@ docs = [
157157
"pyarrow >= 1.0.0",
158158
"pydantic >=2.0",
159159
"pyspark",
160-
"openlineage-python",
160+
"openlineage-python",
161161
"PyYAML",
162162
"ray",
163163
"readthedocs-sphinx-ext<2.3", # read the docs pins

ui/sdk/.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
python -m pip install -r requirements-dev.txt
2929
- name: Run pre-commit hooks
3030
run: |
31-
pre-commit run --all-files
31+
prek run --all-files
3232
- name: Test with pytest
3333
run: |
3434
pip install -r requirements-test.txt

ui/sdk/.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# pre-commit hooks require a user to have installed `pre-commit`:
2-
# $ brew install pre-commit
1+
# pre-commit hooks require a user to have installed `prek`:
2+
# $ brew install prek
33
# Then install the hooks within the repo:
44
# $ cd /PATH/TO/REPO
5-
# $ pre-commit install
5+
# $ prek install
66

77
repos:
88
- repo: https://github.com/charliermarsh/ruff-pre-commit
@@ -12,12 +12,12 @@ repos:
1212
- id: ruff
1313
args: [ --fix , --exit-non-zero-on-fix ]
1414
- repo: https://github.com/ambv/black
15-
rev: 23.3.0
15+
rev: 26.1.0
1616
hooks:
1717
- id: black
1818
args: [--line-length=100]
1919
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v4.4.0
20+
rev: v6.0.0
2121
hooks:
2222
- id: trailing-whitespace
2323
# ensures files are either empty or end with a blank line

ui/sdk/developer_setup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ pip install \
5353
-r ./requirements-test.txt
5454
```
5555

56-
Set up `pre-commit`, which will run some lightweight formatting and linting tasks on every commit.
56+
Set up `prek`, which will run some lightweight formatting and linting tasks on every commit.
5757

5858
```shell
59-
pre-commit install
59+
prek install
6060
```
6161

6262
### Create a pull request
@@ -83,10 +83,10 @@ Make changes, commit them, and push them to your fork.
8383
git push origin HEAD
8484
```
8585

86-
Test your changes locally with `pre-commit`...
86+
Test your changes locally with `prek`...
8787

8888
```shell
89-
pre-commit run --all-files
89+
prek run --all-files
9090
```
9191

9292
...and by following the steps in ["How to run unit tests"](#how-to-run-unit-tests).

ui/sdk/requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
black
22
openapi-python-client
33
pandera # for cli examples
4-
pre-commit
4+
prek
55
ruff
66
scikit-learn # for cli examples

writeups/developer_setup.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ Please be informed to use escape characters or wrap the argument in quote as sho
5454
pip install '.[dev,test]'
5555
```
5656

57-
Set up `pre-commit`, which will run some lightweight formatting and linting tasks on every commit.
57+
Set up `prek`, which will run some lightweight formatting and linting tasks on every commit.
5858

5959
```shell
60-
pre-commit install
60+
prek install
6161
```
6262

6363
### Create a pull request
@@ -84,10 +84,10 @@ Make changes, commit them, and push them to your fork.
8484
git push origin HEAD
8585
```
8686

87-
Test your changes locally with `pre-commit`...
87+
Test your changes locally with `prek`...
8888

8989
```shell
90-
pre-commit run --all-files
90+
prek run --all-files
9191
```
9292

9393
...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:
113113
* `async` = unit tests using the async driver
114114
* `dask` = unit tests using the `dask` adapter
115115
* `integrations` = tests on integrations with other frameworks
116-
* `pre-commit` = static analysis (i.e. linting)
116+
* `prek` = static analysis (i.e. linting)
117117
* `pyspark` = unit tests using the `spark` adapter
118118
* `ray` = unit tests using the `ray` adapter
119119
* `tests` = core unit tests with minimal requirements

0 commit comments

Comments
 (0)