Skip to content

Commit 76c45c5

Browse files
committed
chore: get ready for lecture
Signed-off-by: Henry Schreiner <[email protected]>
1 parent bc634be commit 76c45c5

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ repos:
1414
- id: trailing-whitespace
1515

1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.12.10
17+
rev: v0.13.2
1818
hooks:
1919
- id: ruff-format
2020
exclude: ^content/week01/cleanup_bessel\.ipynb$
2121

2222
- repo: https://github.com/adamchainz/blacken-docs
23-
rev: 1.19.1
23+
rev: 1.20.0
2424
hooks:
2525
- id: blacken-docs
2626
additional_dependencies: [black==24.*]

content/week04_package/precommit.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Here is a minimal `.pre-commit-config.yaml` file with some handy options:
4040
```yaml
4141
repos:
4242
- repo: https://github.com/pre-commit/pre-commit-hooks
43-
rev: "v4.6.0"
43+
rev: "v6.0.0"
4444
hooks:
4545
- id: check-added-large-files
4646
- id: check-case-conflict
@@ -91,7 +91,7 @@ Here is the snippet to add Black to your `.pre-commit-config.yml`:
9191

9292
```yaml
9393
- repo: https://github.com/psf/black-pre-commit-mirror
94-
rev: "24.8.0"
94+
rev: "25.9.0"
9595
hooks:
9696
- id: black
9797
```
@@ -115,7 +115,7 @@ Jupyter outputs:
115115

116116
```yaml
117117
- repo: https://github.com/kynan/nbstripout
118-
rev: "0.7.1"
118+
rev: "0.8.1"
119119
hooks:
120120
- id: nbstripout
121121
```
@@ -129,7 +129,7 @@ The MyPy addition for pre-commit:
129129

130130
```yaml
131131
- repo: https://github.com/pre-commit/mirrors-mypy
132-
rev: "v1.11.2"
132+
rev: "v1.18.2"
133133
hooks:
134134
- id: mypy
135135
files: src
@@ -141,15 +141,15 @@ designed to avoid configuration, but you should add configuration. You can also
141141
add items to the virtual environment setup for MyPy by pre-commit, for example:
142142

143143
```yaml
144-
additional_dependencies: [attrs==21.2.0]
144+
additional_dependencies: [attrs==25.3.0]
145145
```
146146

147147
MyPy has a config section in `pyproject.toml` that looks like this:
148148

149149
```ini
150150
[tool.mypy]
151151
files = "src"
152-
python_version = "3.9"
152+
python_version = "3.10"
153153
strict = true
154154
show_error_codes = true
155155
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
@@ -189,9 +189,9 @@ failures from plugins updating without updating your pre-commit hook.
189189

190190
```yaml
191191
- repo: https://github.com/astral-sh/ruff-pre-commit
192-
rev: "v0.6.8"
192+
rev: "v0.13.2"
193193
hooks:
194-
- id: ruff
194+
- id: ruff-check
195195
args: ["--fix", "--show-fixes"]
196196
- id: ruff-format
197197
```
@@ -230,7 +230,6 @@ extend-select = [
230230
ignore = [
231231
"PLR", # Design related pylint codes
232232
"PT004", # Use underscore for non-returning fixture (use usefixture instead)
233-
"ISC001", # Conflicts with formatter
234233
]
235234
flake8-unused-arguments.ignore-variadic-names = true
236235
isort.required-imports = ["from __future__ import annotations"]
@@ -250,13 +249,12 @@ disable auto-fixing for specific error codes via `unfixable`.
250249

251250
There are other configuration options, such as the `src` list which tells it
252251
where to look for top level packages (mostly for "I" codes, which also have a
253-
lot of custom configuration options) {% rr RF003 %}, `typing-modules`, which
254-
helps apply typing-specific rules to a re-exported typing module (a common
255-
practice for unifying typing and `typing_extensions` based on Python version).
256-
There's also a file `exclude` set, which you can override if you are running
257-
this entirely from pre-commit (default excludes include "build", so if you have
258-
a `build` module or file named `build.py`, it would get skipped by default
259-
without this).
252+
lot of custom configuration options), `typing-modules`, which helps apply
253+
typing-specific rules to a re-exported typing module (a common practice for
254+
unifying typing and `typing_extensions` based on Python version). There's also a
255+
file `exclude` set, which you can override if you are running this entirely from
256+
pre-commit (default excludes include "build", so if you have a `build` module or
257+
file named `build.py`, it would get skipped by default without this).
260258

261259
Here are some good error codes to enable on most (but not all!) projects:
262260

@@ -303,7 +301,7 @@ spell checkers, this has a list of mistakes it looks for, rather than a list of
303301

304302
```yaml
305303
- repo: https://github.com/codespell-project/codespell
306-
rev: "v2.3.0"
304+
rev: "v2.4.1"
307305
hooks:
308306
- id: codespell
309307
args: ["-L", "sur,nd"]

content/week05_ci/ci.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
python-version: "3.12"
8383

8484
- name: Install package
85-
run: python -m pip install .[test]
85+
run: python -m pip install -e.[test]
8686

8787
- name: Test package
8888
run: python -m pytest
@@ -98,7 +98,7 @@ The `jobs:` dict is the other required key, and it has holds a dict with
9898
arbitrary keys; we used the name `tests:`, but it could have been `hefalump:`
9999
instead, it's the unique "id" of the job. Inside each job, you'll at least have
100100
a `runs-on:` setting that tells GHA which operating system image to run on (like
101-
`ubuntu-latests`, `ubunutu-22.04`, `macos-latest`, `windows-latest`, etc.) There
101+
`ubuntu-latests`, `ubunutu-24.04`, `macos-latest`, `windows-latest`, etc.) There
102102
is also are required `steps:`, containing a list of steps.
103103

104104
GitHub Actions runs each step. Steps have an optional (but nice) `name:`. Then
@@ -168,14 +168,14 @@ example:
168168
strategy:
169169
matrix:
170170
runs-on: [ubuntu-latest, windows-latest]
171-
python-version: ["3.9", "3.11"]
171+
python-version: ["3.10", "3.13"]
172172
include:
173173
- runs-on: macos-latest
174-
python-version: "3.10"
174+
python-version: "3.11"
175175
```
176176

177-
Will generate 5 jobs - ubuntu + 3.9, ubuntu + 3.11, windows + 3.9, windows +
178-
3.11, and macos + 3.10.
177+
Will generate 5 jobs - ubuntu + 3.10, ubuntu + 3.13, windows + 3.10, windows +
178+
3.13, and macos + 3.11.
179179

180180
(Advanced) You can also use this to add a new key to an existing run if all
181181
pre-defined keys match an existing run.
@@ -190,7 +190,7 @@ There are a lot of useful variables available to you. One to highlight is
190190
`runner.os`, which will tell you what OS you are on. It is usually better to
191191
write `if: runner.os == "Linux"` over `if: matrix.runs-on == "ubuntu-latest"`,
192192
since it is less fragile, especially if you use versioned image runners like
193-
`ubuntu-22.04`; it also doesn't depend on whatever you named `runs-on` in your
193+
`ubuntu-24.04`; it also doesn't depend on whatever you named `runs-on` in your
194194
matrix.
195195

196196
### Useful things to know
@@ -222,6 +222,10 @@ updates:
222222
directory: "/"
223223
schedule:
224224
interval: "weekly"
225+
groups:
226+
actions:
227+
patterns:
228+
- "*"
225229
```
226230

227231
This will check to see if there are updates to the action weekly, and will make
@@ -274,22 +278,21 @@ tests:
274278
fail-fast: false
275279
matrix:
276280
python-version:
277-
- "3.9"
281+
- "3.10"
278282
- "3.13"
279283
name: Check Python ${{ matrix.python-version }}
280284
steps:
281285
- uses: actions/checkout@v4
282286
287+
- uses: astral-sh/setup-uv@v6
288+
283289
- name: Setup Python ${{ matrix.python-version }}
284290
uses: actions/setup-python@v5
285291
with:
286292
python-version: ${{ matrix.python-version }}
287293
288-
- name: Install package
289-
run: python -m pip install -e .[test]
290-
291-
- name: Test package
292-
run: python -m pytest
294+
- name: Install and test package (using dev group)
295+
run: uv run pytest
293296
```
294297

295298
A few things to note from above:
@@ -348,6 +351,7 @@ There are a variety of useful actions. There are GitHub supplied ones:
348351

349352
And many other useful ones:
350353

354+
- [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv): Setup uv.
351355
- [ilammy/msvc-dev-cmd](https://github.com/ilammy/msvc-dev-cmd): Setup MSVC
352356
compilers.
353357
- [jwlawson/actions-setup-cmake](https://github.com/jwlawson/actions-setup-cmake):

0 commit comments

Comments
 (0)