Skip to content

Commit 35f0f1e

Browse files
committed
πŸ“ update CONTRIBUTING.md for uvx tox and uvx pre-commit
1 parent 0e175de commit 35f0f1e

File tree

1 file changed

+69
-19
lines changed

1 file changed

+69
-19
lines changed

β€ŽCONTRIBUTING.md

Lines changed: 69 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -192,43 +192,93 @@ uv sync --frozen
192192
### pre-commit
193193

194194
`scipy-stubs` uses [pre-commit](https://pre-commit.com/) to ensure that the code is
195-
formatted and typed correctly when committing the changes.
195+
formatted and typed correctly when committing the changes. For better performance,
196+
you could additionally install [`pre-commit-uv`](https://github.com/tox-dev/pre-commit-uv):
196197

197198
```bash
198-
poe pre-commit
199+
uv tool install pre-commit --with pre-commit-uv --force-reinstall
200+
```
201+
202+
<details>
203+
<summary>Output:</summary>
204+
205+
```plaintext
206+
Resolved 11 packages in 74ms
207+
Prepared 11 packages in 1ms
208+
Uninstalled 11 packages in 9ms
209+
Installed 11 packages in 10ms
210+
~ cfgv==3.4.0
211+
~ distlib==0.3.9
212+
~ filelock==3.17.0
213+
~ identify==2.6.6
214+
~ nodeenv==1.9.1
215+
~ platformdirs==4.3.6
216+
~ pre-commit==4.1.0
217+
~ pre-commit-uv==4.1.4
218+
~ pyyaml==6.0.2
219+
~ uv==0.5.23
220+
~ virtualenv==20.29.1
221+
Installed 1 executable: pre-commit
222+
```
223+
224+
</details>
225+
226+
Now to install the git hook script, make sure that your the root directory of the `scipy-stubs` repo, then run:
227+
228+
```bash
229+
uvx pre-commit install
230+
```
231+
232+
Output:
233+
234+
```plaintext
235+
pre-commit installed at .git/hooks/pre-commit
199236
```
200237

201238
> [!NOTE]
202-
> Pre-commit doesn't run `stubtest`. This will be run by github actions
203-
> when submitting a pull request. See the next section for more details.
239+
> For performance reasons, `pre-commit` won't run `mypy` and `stubtest`. You could do this
240+
> yourself with `tox -e mypy` and `tox -e stubtest`, as explained in the next section.
241+
> That way you won't have to rely on the (slow) github actions workflow when you submit your PR.
204242
205243
### Tox
206244

207245
The pre-commit hooks and `stubtest` can easily be run with [tox](https://github.com/tox-dev/tox).
208246
It can be installed with:
209247

210248
```bash
211-
uv tool install tox --with tox-uv
249+
uv tool install tox --with tox-uv --upgrade
212250
```
213251

214252
To run all environments in parallel, run:
215253

216-
```shell
217-
$ tox -p all
218-
repo-review: OK βœ” in 0.4 seconds
219-
3.12: OK βœ” in 10.38 seconds
220-
3.10: OK βœ” in 10.62 seconds
221-
3.11: OK βœ” in 11.04 seconds
222-
3.13: OK βœ” in 19.42 seconds
223-
repo-review: OK (0.40=setup[0.04]+cmd[0.36] seconds)
224-
pre-commit: OK (24.91=setup[0.04]+cmd[24.87] seconds)
225-
3.10: OK (10.62=setup[0.11]+cmd[10.51] seconds)
226-
3.11: OK (11.04=setup[0.04]+cmd[11.00] seconds)
227-
3.12: OK (10.38=setup[0.04]+cmd[10.34] seconds)
228-
3.13: OK (19.42=setup[0.04]+cmd[19.38] seconds)
229-
congratulations :) (24.96 seconds)
254+
```bash
255+
uvx tox p
230256
```
231257

258+
<details>
259+
<summary>Output:</summary>
260+
261+
```plaintext
262+
lint: OK βœ” in 0.52 seconds
263+
pre-commit: OK βœ” in 2.59 seconds
264+
3.11: OK βœ” in 21.59 seconds
265+
mypy: OK βœ” in 21.62 seconds
266+
pyright: OK βœ” in 25.23 seconds
267+
3.10: OK βœ” in 25.4 seconds
268+
3.12: OK βœ” in 38.71 seconds
269+
pre-commit: OK (2.59=setup[0.03]+cmd[2.56] seconds)
270+
lint: OK (0.52=setup[0.04]+cmd[0.41,0.03,0.05] seconds)
271+
pyright: OK (25.23=setup[0.03]+cmd[25.20] seconds)
272+
mypy: OK (21.62=setup[0.03]+cmd[21.59] seconds)
273+
3.13: OK (53.28=setup[0.03]+cmd[53.25] seconds)
274+
3.12: OK (38.71=setup[0.03]+cmd[38.68] seconds)
275+
3.11: OK (21.59=setup[0.03]+cmd[21.55] seconds)
276+
3.10: OK (25.40=setup[0.03]+cmd[25.36] seconds)
277+
congratulations :) (53.35 seconds)
278+
```
279+
280+
</details>
281+
232282
### Commit message style
233283

234284
See <https://gitmoji.dev/>.

0 commit comments

Comments
Β (0)