Commit 4c056a9
committed
✨ Template | pre-commit: Add mypy type checking
Generated packages can now opt into mypy via a new `type_check` Copier question (none /
loose / strict, default loose).
The hook is a local pre-commit entry with `language: system`, so mypy runs inside the
hatch `pre-commit` environment and sees every installed project dependency — no
`additional_dependencies` list to maintain. `mypy` is added to the `pre-commit`
optional-deps group when type checking is enabled.
Two `[tool.mypy]` presets:
- `loose` turns on `warn_unused_ignores`, `warn_redundant_casts`, and
`warn_unreachable`
- `strict` enables mypy's built-in `strict = true`.
Both scope checking to `src/` and pin `python_version = "3.10"` to match
`requires-python`.
CI coverage is automatic — the existing `hatch run pre-commit:run --all-files` job picks
up the new hook.1 parent 8fa76b9 commit 4c056a9
3 files changed
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
0 commit comments