-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
109 lines (104 loc) · 3.63 KB
/
.pre-commit-config.yaml
File metadata and controls
109 lines (104 loc) · 3.63 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
default_stages: [pre-push]
repos:
# Priority 0: Type checkers (slowest — start immediately, run in parallel)
- repo: local
hooks:
- id: ty
name: ty (type checker)
entry: uv run ty check
language: python
always_run: true
pass_filenames: false
priority: 0
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.387
hooks:
- id: pyright
additional_dependencies: [".[tests]"]
exclude: ".github/scripts/validate_docs_coverage.py"
always_run: true
pass_filenames: false
priority: 0
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.19.1"
hooks:
- id: mypy
additional_dependencies:
[types-pkg-resources==0.1.3, types-all, wandb>=0.15.5, wandb<0.19.0]
# Note: You have to update pyproject.toml[tool.mypy] too!
args: ["--config-file=pyproject.toml", "."]
exclude: (.*pyi$)|(tests)|(examples)|(.github/scripts/validate_docs_coverage.py)
always_run: true
pass_filenames: false
priority: 0
# Priority 0: Read-only checks (fast, run alongside type checkers)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#check-added-large-files
- id: check-added-large-files
args: ["--maxkb=2048"]
priority: 0
# https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#check-json
- id: check-json
exclude: (.*pyi$)|(tests)|(examples)
priority: 0
# https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#check-yaml
- id: check-yaml
priority: 0
# https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#detect-private-key
- id: detect-private-key
priority: 0
- repo: https://github.com/crate-ci/typos
rev: v1.44.0
hooks:
- id: typos
# Excluding extra things to make initial reviews easier, starting with `examples``
exclude: "(cassettes|examples|tests|tools)"
priority: 0
# Priority 0: Asset-modifying hooks (non-Python files, no conflict with type checkers)
- repo: https://github.com/oxipng/oxipng
rev: v10.1.0
hooks:
- id: oxipng
args: ["-o", "4", "--strip", "safe", "--alpha"]
priority: 0
- repo: local
hooks:
- id: jupyter-nb-clear-output
name: jupyter-nb-clear-output
files: ^examples/.*\.ipynb$
language: system
entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace
priority: 0
- id: strip-exif
name: Strip EXIF data
entry: uv run scripts/strip_exif.py
language: python
types: [image]
priority: 0
# Priority 1: Code modernization (modify Python files)
- repo: https://github.com/Instagram/Fixit
rev: v2.2.1
hooks:
- id: fixit-fix
priority: 1
# Priority 2: Linting with auto-fix (must run before formatter)
# Priority 3: Formatting (runs after linting fixes)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.5
hooks:
- id: ruff-check
types_or: [python, pyi, jupyter]
args: [--fix, --exit-non-zero-on-fix, --config=pyproject.toml]
exclude: ".github/scripts/validate_docs_coverage.py"
always_run: true
pass_filenames: false
priority: 2
- id: ruff-format
args: [--config=pyproject.toml]
types_or: [python, pyi, jupyter]
exclude: ".github/scripts/validate_docs_coverage.py"
always_run: true
pass_filenames: false
priority: 3