Skip to content

Commit 4348ee8

Browse files
authored
Replace pre-commit by prek (#2533)
<!-- Thanks for opening a pull request! --> <!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. --> <!-- Closes #${GITHUB_ISSUE_ID} --> # Rationale for this change It replaces pre-commit with prek, which is almost 10x faster. prek is a port of pre-commit to rust. ## Are these changes tested? Yes. `make lint` is running locally ## Are there any user-facing changes? Only for developers, given that it affects `make lint`, **NOTE**: I had to update the poetry.lock file with `poetry lock`, resulting in multiple changes. Maybe it's better to run again in your machine (I don't know if it's run automatically in the CI pipeline). <!-- In the case of user-facing changes, please add the changelog label. -->
1 parent e32ba2a commit 4348ee8

File tree

5 files changed

+1792
-1450
lines changed

5 files changed

+1792
-1450
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ repos:
3737
hooks:
3838
- id: mypy
3939
args:
40-
[--install-types, --non-interactive, --config=pyproject.toml]
40+
[--config=pyproject.toml]
41+
additional_dependencies:
42+
- types-cachetools
43+
- types-pytest-lazy-fixture
44+
- types-pytz
45+
- types-requests
4146
- repo: https://github.com/igorshubovych/markdownlint-cli
4247
rev: v0.45.0
4348
hooks:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ install: install-poetry install-dependencies ## Install Poetry and dependencies
8383
check-license: ## Check license headers
8484
./dev/check-license
8585

86-
lint: ## Run code linters via pre-commit
87-
$(POETRY) run pre-commit run --all-files
86+
lint: ## Run code linters via prek (pre-commit hooks)
87+
$(POETRY) run prek run -a
8888

8989
# ===============
9090
# Testing Section

mkdocs/docs/contributing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ pip install "git+https://github.com/apache/iceberg-python.git#egg=pyiceberg[pyar
8080

8181
## Linting
8282

83-
`pre-commit` is used for autoformatting and linting:
83+
`prek` is used for autoformatting and linting:
8484

8585
```bash
8686
make lint
8787
```
8888

89-
Pre-commit will automatically fix the violations such as import orders, formatting etc. Pylint errors you need to fix yourself.
89+
`prek` will automatically fix the violations such as import orders, formatting etc. Pylint errors you need to fix yourself.
9090

91-
In contrast to the name suggest, it doesn't run the checks on the commit. If this is something that you like, you can set this up by running `pre-commit install`.
91+
In addition to manually running `make lint`, you can install the pre-commit hooks in your local repo with `prek install`. By doing this, linting is run automatically every time you make a commit.
9292

93-
You can bump the integrations to the latest version using `pre-commit autoupdate`. This will check if there is a newer version of `{black,mypy,isort,...}` and update the yaml.
93+
You can bump the integrations to the latest version using `prek auto-update`. This will check if there is a newer version of `{black,mypy,isort,...}` and update the yaml.
9494

9595
## Cleaning
9696

0 commit comments

Comments
 (0)