Skip to content

Commit bef0907

Browse files
authored
Merge branch 'main' into fix/nested-shard-reads
2 parents 38015ae + 3fa19d2 commit bef0907

File tree

7 files changed

+62
-10
lines changed

7 files changed

+62
-10
lines changed

.github/workflows/check_changelogs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
12+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1313

1414
- name: Install uv
1515
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0

.github/workflows/codspeed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Run benchmarks
1818
runs-on: codspeed-macro
1919
steps:
20-
- uses: actions/checkout@v5
20+
- uses: actions/checkout@v6
2121
with:
2222
fetch-depth: 0 # grab all branches and tags
2323
- name: Set up Python

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main, 3.1.x]
6+
pull_request:
7+
branches: [main, 3.1.x]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v6
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v5
22+
- name: Install prek
23+
run: uv tool install prek
24+
- name: Run prek
25+
run: prek run --all-files

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
ci:
22
autoupdate_commit_msg: "chore: update pre-commit hooks"
33
autoupdate_schedule: "monthly"
4-
autofix_commit_msg: "style: pre-commit fixes"
54
autofix_prs: false
5+
skip: [] # pre-commit.ci only checks for updates, prek runs hooks locally
6+
67
default_stages: [pre-commit, pre-push]
78

89
default_language_version:

changes/3658.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Switch from `pre-commit` to [`prek`](https://github.com/j178/prek) for pre-commit checks.

docs/contributing.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,26 +109,50 @@ All tests are automatically run via GitHub Actions for every pull request and mu
109109

110110
> **Note:** Previous versions of Zarr-Python made extensive use of doctests. These tests were not maintained during the 3.0 refactor but may be brought back in the future. See issue #2614 for more details.
111111
112-
### Code standards - using pre-commit
112+
### Code standards - using prek
113113

114114
All code must conform to the PEP8 standard. Regarding line length, lines up to 100 characters are allowed, although please try to keep under 90 wherever possible.
115115

116-
`Zarr` uses a set of `pre-commit` hooks and the `pre-commit` bot to format, type-check, and prettify the codebase. `pre-commit` can be installed locally by running:
116+
`Zarr` uses a set of git hooks managed by [`prek`](https://github.com/j178/prek), a fast, Rust-based pre-commit hook manager that is fully compatible with `.pre-commit-config.yaml` files. `prek` can be installed locally by running:
117117

118118
```bash
119-
python -m pip install pre-commit
119+
uv tool install prek
120+
```
121+
122+
or:
123+
124+
```bash
125+
pip install prek
120126
```
121127

122128
The hooks can be installed locally by running:
123129

124130
```bash
125-
pre-commit install
131+
prek install
132+
```
133+
134+
This would run the checks every time a commit is created locally. The checks will by default only run on the files modified by a commit, but the checks can be triggered for all the files by running:
135+
136+
```bash
137+
prek run --all-files
138+
```
139+
140+
You can also run hooks only for files in a specific directory:
141+
142+
```bash
143+
prek run --directory src/zarr
144+
```
145+
146+
Or run hooks for files changed in the last commit:
147+
148+
```bash
149+
prek run --last-commit
126150
```
127151

128-
This would run the checks every time a commit is created locally. These checks will also run on every commit pushed to an open PR, resulting in some automatic styling fixes by the `pre-commit` bot. The checks will by default only run on the files modified by a commit, but the checks can be triggered for all the files by running:
152+
To list all available hooks:
129153

130154
```bash
131-
pre-commit run --all-files
155+
prek list
132156
```
133157

134158
If you would like to skip the failing checks and push the code for further discussion, use the `--no-verify` option with `git commit`.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ maintainers = [
3030
{ name = "Deepak Cherian" }
3131
]
3232
requires-python = ">=3.11"
33-
# If you add a new dependency here, please also add it to .pre-commit-config.yml
33+
# If you add a new dependency here, please also add it to .pre-commit-config.yaml
3434
dependencies = [
3535
'packaging>=22.0',
3636
'numpy>=2.0',
@@ -428,6 +428,7 @@ markers = [
428428
ignore = [
429429
"PC111", # fix Python code in documentation - enable later
430430
"PC180", # for JavaScript - not interested
431+
"PC902", # pre-commit.ci custom autofix message - not using autofix
431432
]
432433

433434
[tool.numpydoc_validation]

0 commit comments

Comments
 (0)