Skip to content

Commit 099f7ae

Browse files
committed
Make pre-commit work without activating a virtualenv
1 parent efc20c0 commit 099f7ae

File tree

2 files changed

+84
-56
lines changed

2 files changed

+84
-56
lines changed

.pre-commit-config.yaml

Lines changed: 83 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ci:
77
# We use system Python, with required dependencies specified in pyproject.toml.
88
# We therefore cannot use those dependencies in pre-commit CI.
99
skip:
10+
- actionlint
1011
- check-manifest
1112
- deptry
1213
- doc8
@@ -60,190 +61,217 @@ repos:
6061
hooks:
6162
- id: actionlint
6263
name: actionlint
63-
entry: uv run --all-extras actionlint
64+
entry: uv run --extra=dev actionlint
6465
language: python
6566
pass_filenames: false
6667
types_or: [yaml]
6768
additional_dependencies: ["uv"]
6869

6970
- id: shellcheck
7071
name: shellcheck
71-
entry: shellcheck --shell=bash --exclude=SC1017
72-
language: system
72+
entry: uv run --extra=dev shellcheck --shell=bash --exclude=SC1017
73+
language: python
7374
pass_filenames: false
7475
types_or: [shell]
76+
additional_dependencies: ["uv"]
7577

7678
- id: shellcheck-docs
7779
name: shellcheck-docs
78-
entry: doccmd --language=shell --language=console --command="shellcheck --shell=bash --exclude=SC1017"
79-
language: system
80+
entry: uv run --extra=dev doccmd --language=shell --language=console --command="shellcheck --shell=bash --exclude=SC1017"
81+
language: python
8082
types_or: [markdown, rst]
83+
additional_dependencies: ["uv"]
8184

8285
- id: shfmt
8386
name: shfmt
84-
entry: shfmt --write --space-redirects --indent=4
85-
language: system
87+
entry: uv run --extra=dev shfmt --write --space-redirects --indent=4
88+
language: python
8689
types_or: [shell]
90+
additional_dependencies: ["uv"]
8791

8892
- id: shfmt-docs
8993
name: shfmt-docs
90-
entry: doccmd --language=shell --language=console --skip-marker=shfmt --no-pad-file --command="shfmt --write --space-redirects --indent=4"
91-
language: system
94+
entry: uv run --extra=dev doccmd --language=shell --language=console --skip-marker=shfmt --no-pad-file --command="shfmt --write --space-redirects --indent=4"
95+
language: python
9296
types_or: [markdown, rst]
97+
additional_dependencies: ["uv"]
9398

9499
- id: mypy
95100
name: mypy
96101
stages: [push]
97-
entry: python -m mypy .
98-
language: system
102+
entry: uv run --extra=dev -m mypy .
103+
language: python
99104
types_or: [python, toml]
100105
pass_filenames: false
106+
additional_dependencies: ["uv"]
101107

102108
- id: mypy-docs
103109
name: mypy-docs
104110
stages: [push]
105-
entry: doccmd --language=python --command="mypy"
106-
language: system
111+
entry: uv run --extra=dev doccmd --language=python --command="mypy"
112+
language: python
107113
types_or: [markdown, rst, python, toml]
114+
additional_dependencies: ["uv"]
108115

109116
- id: check-manifest
110117
name: check-manifest
111118
stages: [push]
112-
entry: python -m check_manifest .
113-
language: system
119+
entry: uv run --extra=dev -m check_manifest .
120+
language: python
114121
pass_filenames: false
122+
additional_dependencies: ["uv"]
115123

116124
- id: pyright
117125
name: pyright
118126
stages: [push]
119-
entry: python -m pyright .
120-
language: system
127+
entry: uv run --extra=dev -m pyright .
128+
language: python
121129
types_or: [python, toml]
122130
pass_filenames: false
131+
additional_dependencies: ["uv"]
123132

124133
- id: pyright-docs
125134
name: pyright-docs
126135
stages: [push]
127-
entry: doccmd --language=python --command="pyright"
128-
language: system
136+
entry: uv run --extra=dev doccmd --language=python --command="pyright"
137+
language: python
129138
types_or: [markdown, rst, python, toml]
139+
additional_dependencies: ["uv"]
130140

131141
- id: vulture
132142
name: vulture
133-
entry: python -m vulture .
134-
language: system
143+
entry: uv run --extra=dev -m vulture .
144+
language: python
135145
types_or: [python]
136146
pass_filenames: false
147+
additional_dependencies: ["uv"]
137148

138149
- id: vulture-docs
139150
name: vulture docs
140-
entry: doccmd --language=python --command="vulture"
141-
language: system
151+
entry: uv run --extra=dev doccmd --language=python --command="vulture"
152+
language: python
142153
types_or: [markdown, rst]
154+
additional_dependencies: ["uv"]
143155

144156
- id: pyroma
145157
name: pyroma
146-
entry: python -m pyroma --min 10 .
147-
language: system
158+
entry: uv run --extra=dev -m pyroma --min 10 .
159+
language: python
148160
pass_filenames: false
149161
types_or: [toml]
162+
additional_dependencies: ["uv"]
150163

151164
- id: deptry
152165
name: deptry
153-
entry: python -m deptry src/
154-
language: system
166+
entry: uv run --extra=dev -m deptry src/
167+
language: python
155168
pass_filenames: false
169+
additional_dependencies: ["uv"]
156170

157171
- id: pylint
158172
name: pylint
159-
entry: python -m pylint *.py src/ tests/ docs/
160-
language: system
173+
entry: uv run --extra=dev -m pylint *.py src/ tests/ docs/
174+
language: python
161175
stages: [manual]
162176
pass_filenames: false
177+
additional_dependencies: ["uv"]
163178

164179
- id: pylint-docs
165180
name: pylint-docs
166-
entry: doccmd --language=python --command="pylint"
167-
language: system
181+
entry: uv run --extra=dev doccmd --language=python --command="pylint"
182+
language: python
168183
stages: [manual]
169184
types_or: [markdown, rst, python, toml]
185+
additional_dependencies: ["uv"]
170186

171187
- id: ruff-check-fix
172188
name: Ruff check fix
173-
entry: python -m ruff check --fix
174-
language: system
189+
entry: uv run --extra=dev -m ruff check --fix
190+
language: python
175191
types_or: [python]
192+
additional_dependencies: ["uv"]
176193

177194
- id: ruff-check-fix-docs
178195
name: Ruff check fix docs
179-
entry: doccmd --language=python --command="ruff check --fix"
180-
language: system
196+
entry: uv run --extra=dev doccmd --language=python --command="ruff check --fix"
197+
language: python
181198
types_or: [markdown, rst]
199+
additional_dependencies: ["uv"]
182200

183201
- id: ruff-format-fix
184202
name: Ruff format
185-
entry: python -m ruff format
186-
language: system
203+
entry: uv run --extra=dev -m ruff format
204+
language: python
187205
types_or: [python]
206+
additional_dependencies: ["uv"]
188207

189208
- id: ruff-format-fix-docs
190209
name: Ruff format docs
191-
entry: doccmd --language=python --no-pad-file --command="ruff format"
192-
language: system
210+
entry: uv run --extra=dev doccmd --language=python --no-pad-file --command="ruff format"
211+
language: python
193212
types_or: [markdown, rst]
213+
additional_dependencies: ["uv"]
194214

195215
- id: doc8
196216
name: doc8
197-
entry: python -m doc8
198-
language: system
217+
entry: uv run --extra=dev -m doc8
218+
language: python
199219
types_or: [rst]
220+
additional_dependencies: ["uv"]
200221

201222
- id: interrogate
202223
name: interrogate
203-
entry: python -m interrogate
204-
language: system
224+
entry: uv run --extra=dev -m interrogate
225+
language: python
205226
types_or: [python]
227+
additional_dependencies: ["uv"]
206228

207229
- id: interrogate-docs
208230
name: interrogate docs
209-
entry: doccmd --language=python --command="interrogate"
210-
language: system
231+
entry: uv run --extra=dev doccmd --language=python --command="interrogate"
232+
language: python
211233
types_or: [markdown, rst]
234+
additional_dependencies: ["uv"]
212235

213236
- id: pyproject-fmt-fix
214237
name: pyproject-fmt
215-
entry: pyproject-fmt
216-
language: system
238+
entry: uv run --extra=dev pyproject-fmt
239+
language: python
217240
types_or: [toml]
218241
files: pyproject.toml
242+
additional_dependencies: ["uv"]
219243

220244
- id: linkcheck
221245
name: linkcheck
222-
entry: make -C docs/ linkcheck SPHINXOPTS=-W
223-
language: system
246+
entry: uv run --extra=dev sphinx-build -M clean docs/source/ docs/build/ -W && uv run --extra=dev sphinx-build -M linkcheck docs/source/ docs/build/ -W
247+
language: python
224248
types_or: [rst]
225249
stages: [manual]
226250
pass_filenames: false
251+
additional_dependencies: ["uv"]
227252

228253
- id: spelling
229254
name: spelling
230-
entry: make -C docs/ spelling SPHINXOPTS=-W
231-
language: system
255+
entry: uv run --extra=dev sphinx-build -M clean docs/source/ docs/build/ -W && uv run --extra=dev sphinx-build -M spelling docs/source/ docs/build/ -W
256+
language: python
232257
types_or: [rst]
233258
stages: [manual]
234259
pass_filenames: false
260+
additional_dependencies: ["uv"]
235261

236262
- id: docs
237263
name: Build Documentation
238-
entry: make docs
239-
language: system
264+
entry: uv run --extra=dev sphinx-build -M clean docs/source/ docs/build/ -W && uv run --extra=dev sphinx-build -M html docs/source/ docs/build/ -W
265+
language: python
240266
stages: [manual]
241267
pass_filenames: false
268+
additional_dependencies: ["uv"]
242269

243270
- id: pyright-verifytypes
244271
name: pyright-verifytypes
245272
stages: [push]
246-
entry: python -m pyright --verifytypes vws
247-
language: system
273+
entry: uv run --extra=dev -m pyright --verifytypes vws
274+
language: python
248275
pass_filenames: false
249276
types_or: [python]
277+
additional_dependencies: ["uv"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ optional-dependencies.dev = [
5050
"mypy==1.11.2",
5151
"pre-commit==3.8.0",
5252
"pydocstyle==6.3",
53-
"pyenchant==3.2.2",
53+
"pyenchant==3.3.0rc1",
5454
"pygments==2.18.0",
5555
"pylint==3.3.1",
5656
"pylint-per-file-ignores==1.3.2",

0 commit comments

Comments
 (0)