-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
283 lines (267 loc) · 7.75 KB
/
.pre-commit-config.yaml
File metadata and controls
283 lines (267 loc) · 7.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# pre-commit install
# pre-commit run --all-files
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
autoupdate_commit_msg: "chore(deps): update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
autoupdate_schedule: "weekly"
skip:
- uv-lock
- pip-compile
- pyproject2conda-project
default_install_hook_types:
- pre-commit
- commit-msg
repos:
# * meta hooks
- repo: meta
hooks:
- id: check-hooks-apply
stages: [manual]
- id: check-useless-excludes
stages: [manual]
# * sync dependencies
- repo: https://github.com/wpk-nist-gov/sync-pre-commit-hooks
rev: v0.3.0
hooks:
- id: sync-pre-commit-deps
args:
- "--requirements=requirements/lock/pre-commit-additional-dependencies.txt"
files: >-
^\.pre-commit-config\.yaml$|^requirements/lock/pre-commit-additional-dependencies\.txt$
- id: sync-uv-dependency-groups
- id: justfile-format
additional_dependencies:
- rust-just==1.46.0
# * Forbidden files
- repo: local
hooks:
- id: forbidden-files
name: forbidden files
entry: Found forbidden file.
language: fail
files: \.(rej|bak)$
# * Top level
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
exclude: ^uv[.]lock
- id: check-case-conflict
- id: check-merge-conflict
args: [--assume-in-merge]
- id: check-symlinks
- id: check-yaml
- id: check-json
- id: check-toml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
# * toml/pyproject.toml
# ** format
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
# exclude: (^|/)pyproject\.toml$
- id: taplo-lint
args: ["--no-schema"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.20.0
hooks:
- id: pyproject-fmt
# ** validate (schema-store)
- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: 2026.03.15
hooks:
- id: validate-pyproject
name: validate-pyproject-schema-store
stages: [manual]
# ** repo review
- repo: https://github.com/scientific-python/cookie
rev: 2026.03.02
hooks:
- id: sp-repo-review
stages: [manual]
# * Prettier
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.1
hooks:
- id: prettier
alias: markdownlint
stages: [pre-commit, manual]
args:
- "--cache"
- "--cache-location=.prettier_cache/cache"
# * Markdown
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.21.0
hooks:
- id: markdownlint-cli2
alias: markdownlint
args: [--style, prettier]
# language_version: 10.9.0
# * Linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.6
hooks:
- id: ruff-check
alias: ruff
args: [--fix, --show-fixes]
- id: ruff-format
alias: ruff
- repo: https://github.com/adamtheturtle/doccmd-pre-commit
rev: v2026.3.2
hooks:
- id: doccmd
name: "ruff format markdown"
alias: ruff
args:
- "--language"
- "python"
- "--no-pad-file"
- "--command"
- "ruff format"
additional_dependencies:
- ruff==0.15.6
# * Spelling
# ** typos
- repo: https://github.com/adhtruong/mirrors-typos
rev: v1.44.0
hooks:
- id: typos
exclude_types: [jupyter]
exclude: ^uv[.]lock$|^requirements
# * Dependencies
# ** pyproject2conda
- repo: https://github.com/usnistgov/pyproject2conda
rev: v0.22.1
hooks:
- id: pyproject2conda-project
alias: requirements
args:
- "--custom-command=prek run pyproject2conda-project --all-files"
# ** uv
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.11
hooks:
- id: uv-lock
alias: requirements
args: [--locked]
- id: pip-compile
alias: requirements
entry: python tools/requirements_lock.py
pass_filenames: true
files: ^requirements/[^/]*\.txt$
# * Commit message
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.13.9
hooks:
- id: commitizen
stages: [commit-msg]
# * auto-files
- repo: local
hooks:
- id: parallel-files
name: parallel-files
alias: auto-files
entry: python tools/auto_parallel_files.py
language: python
files: ^src/lnpy/_lib/.*\.py$
pass_filenames: false
# * pooch
- repo: local
hooks:
- id: pooch-registry
name: pooch-registry
entry:
python -c "import pooch; pooch.make_registry('examples/data',
'src/lnpy/data/registry.txt')"
language: python
additional_dependencies:
- pooch >= 1.8.2
files: ^examples/data
pass_filenames: false
# * Actions
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.0
hooks:
- id: check-github-workflows
alias: actions
priority: 0
- id: check-github-actions
alias: actions
- repo: https://github.com/rhysd/actionlint
rev: v1.7.11
hooks:
- id: actionlint
alias: actions
stages: [manual]
args:
- "-ignore=SC2129" # ignorable stylistic lint from shellcheck
- "-ignore=SC2016" # another shellcheck lint: seems to have false positives?
language: golang # means renovate will also update `additional_dependencies`
additional_dependencies:
# actionlint has a shellcheck integration which extracts shell scripts in `run:` steps from GitHub Actions
# and checks these with shellcheck. This is arguably its most useful feature,
# but the integration only works if shellcheck is installed
- "github.com/wasilibs/go-shellcheck/cmd/shellcheck@v0.11.1"
# see https://github.com/rhysd/actionlint/issues/46
exclude: ^\.github/actions
priority: 0
- repo: https://github.com/zizmorcore/zizmor-pre-commit
# Zizmor version.
rev: v1.23.1
hooks:
# Run the linter.
- id: zizmor
alias: actions
# * Notebook specific --------------------------------------------------------
# * Strip out metadata from notebooks
- repo: https://github.com/kynan/nbstripout
rev: 0.9.1
hooks:
- id: nbstripout
args:
- "--keep-output"
- "--keep-count"
- "--extra-keys"
- "metadata.kernelspec metadata.kernel_spec"
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
# ** typos
- id: nbqa
name: nbqa-typos
alias: typos
additional_dependencies: &typos-deps
- typos==1.44.0
args:
- typos
- --force-exclude
- --no-check-filenames
- --write-changes
- --nbqa-shell
exclude: &typos-exclude ^examples/archived
- id: nbqa
name: nbqa-typos-markdown
alias: typos
additional_dependencies: *typos-deps
args:
- typos
- --force-exclude
- --no-check-filenames
- --write-changes
- --nbqa-shell
- --nbqa-md
exclude: *typos-exclude
# ** symlink in notebooks from example/usage to docs/example/usage
- repo: local
hooks:
- id: symlink-docs-examples-notebooks
name: symlink-docs-examples-notebooks
entry: python tools/symlink_docs_examples_notebooks.py
language: python
files: ^docs/examples/.*\.md$
pass_filenames: false