-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
70 lines (70 loc) · 2.13 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
70 lines (70 loc) · 2.13 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
# default is only ["pre-commit"], without changing the default,
# we need to explicitly pass in --hook-type whenever we run "pre-commit install --hook-type ..."
default_install_hook_types:
- pre-commit
- prepare-commit-msg
- commit-msg
- pre-push
exclude: ^afterpython/_website/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
stages:
- pre-commit
- id: end-of-file-fixer
stages:
- pre-commit
- id: check-yaml
stages:
- pre-commit
- id: check-toml
stages:
- pre-commit
- id: check-added-large-files
stages:
- pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.9
hooks:
- id: ruff-check
stages:
- pre-commit
- id: ruff-format
stages:
- pre-commit
- repo: local
# not the official hook (astral-sh/ty-pre-commit), at least for now: it runs `uv check`,
# which always type checks against its own environment built from pyproject.toml,
# so packages only installed by e.g. pixi (like pytest in a pixi feature) can't be found.
# `ap check` uses the project's own environment and ty version, like the editor does.
# It type checks the whole project (like the official hook), not only the staged files,
# since a change in one file can break types in another.
hooks:
- id: ty
name: ty
entry: sh -c 'PATH="$PWD/.venv/bin:$PWD/.venv/Scripts:$PATH" exec ap check'
language: system
types_or: [python, pyi, jupyter]
pass_filenames: false
always_run: true
require_serial: true
stages:
- pre-commit
- repo: local
hooks:
# same id twice so that SKIP=ap-commit skips both
# git GUIs run hooks with a minimal PATH (no uv/venv), so put the project venv on PATH ourselves
- id: ap-commit
name: commit message template
entry: sh -c 'PATH="$PWD/.venv/bin:$PWD/.venv/Scripts:$PATH" exec ap commit-msg --template "$@"' --
language: system
stages:
- prepare-commit-msg
- id: ap-commit
name: check commit message
entry: sh -c 'PATH="$PWD/.venv/bin:$PWD/.venv/Scripts:$PATH" exec ap commit-msg "$@"' --
language: system
stages:
- commit-msg