Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
222 lines (200 loc) · 8.19 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
222 lines (200 loc) · 8.19 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
ci:
autofix_commit_msg: |
[pre-commit.ci] auto code formatting
autofix_prs: false
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: quarterly
skip: [lychee, check-precommit-installed, secret-scan-trufflehog]
submodules: false
# Please update the rev: SHAs below with this command:
# pre-commit autoupdate --freeze
# This unchanged maintenance-source import is inactive until its integration layer.
exclude: ^cuda_bindings_12/
repos:
# Runs first so a leaked credential blocks the commit before any formatter runs.
# Self-installing: the hook downloads a pinned, checksum-verified trufflehog on
# first use (no manual install). Skipped on pre-commit.ci; Pulse CI enforces server-side.
- repo: https://github.com/NVIDIA/security-workflows
rev: c736f0454dc99764a66af6b906adfcdfbf621985 # frozen: v0.4.0
hooks:
- id: secret-scan-trufflehog
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: a56c0b927e6465d37cae3e97d35d4d18ab2b96cd # frozen: v0.16.9
hooks:
- id: ruff-check
args: [--fix, --show-fixes]
exclude: (^cuda_bindings_13/cuda/bindings/_internal/_fast_enum\.py$)|(.*\.pyi$)
- id: ruff-format
exclude: .*\.pyi$
- repo: local
hooks:
- id: check-precommit-installed
name: Warn if the pre-commit git hook is not installed
entry: python ./toolshed/check_precommit_installed.py
language: python
always_run: true
pass_filenames: false
verbose: true
- id: check-cuda-core-bindings-floor
name: Check the cuda-bindings floor against ci/versions.yml and the docs
entry: python ./toolshed/check_cuda_core_bindings_floor.py
language: python
files: ^(cuda_core/pyproject\.toml|ci/versions\.yml|cuda_core/cuda/core/_bindings_floor\.py|cuda_core/docs/source/.*\.rst|toolshed/check_cuda_core_bindings_floor\.py)$
pass_filenames: false
- id: check-spdx
name: Check SPDX Headers
entry: python ./toolshed/check_spdx.py
language: python
additional_dependencies:
- https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl
exclude: '(.*pixi\.lock)|(\.git_archival\.txt)|(.*\.patch$)|(^cuda_core/cuda/core/_vendored/)|(^cuda_core/third_party/)'
args: ["--fix"]
- id: check-cython-not-none
name: Check cdef-class-annotated def parameters carry 'not None'
entry: python ./toolshed/check_cython_not_none.py
language: python
files: ^cuda_core/cuda/.*\.pyx$
- id: check-generated-file-seals
name: Check generated-file seals
entry: python ./toolshed/check_generated_file_seals.py
language: python
files: ^cuda_bindings_13/
types: [text]
- id: check-pixi-cuda-version
name: Check pixi cuda-version pins track ci/versions.yml
entry: python ./ci/tools/check_pixi_cuda_version.py
language: python
additional_dependencies: [pyyaml==6.0.3]
files: '^(ci/versions\.yml|cuda_bindings_13/pixi\.toml|cuda_core/pixi\.toml)$'
pass_filenames: false
- id: check-mempool-hygiene
name: Check tests do not create uncapped memory pools
entry: python ./ci/tools/check_mempool_hygiene.py
language: python
files: '^cuda_core/tests/.*\.py$'
- id: no-markdown-in-docs-source
name: Prevent markdown files in docs/source directories
entry: bash -c
args:
- 'for file in "$@"; do >&2 echo "error: markdown file "$file" found in a docs/source directory. Only reST (.rst) is allowed"; done && exit 1'
- "_" # fake script name, because bash considers $0 (the first argument) to be the script name
language: system
files: '^.*/docs/source/.*\.md$'
- id: stubgen-pyx-cuda-core
name: Generate .pyi stubs for cuda_core
entry: python -X utf8 -m stubgen_pyx cuda_core/cuda --continue-on-error --include-private
language: python
files: ^cuda_core/cuda/.*\.(pyx|pxd)$
pass_filenames: false
additional_dependencies:
- stubgen-pyx==0.2.22
- Cython==3.2.9
# Link checking for authored documentation files
- repo: local
hooks:
- id: lychee
name: lychee (authored documentation)
entry: python ./ci/tools/run_lychee.py
language: python
# Update this shared pin manually until Dependabot releases support for
# local-hook dependencies: https://github.com/dependabot/dependabot-core/issues/15489
# Once supported, add lychee-bin to the allowlist in .github/dependabot.yml.
additional_dependencies: &lychee_dependencies
- lychee-bin==0.24.2
types: [text]
require_serial: true
args:
- --cache
- --max-cache-age=3d
- --max-concurrency=4
- --max-retries=3
- --no-progress
files: '\.(md|rst)$'
exclude: ^qa/
# Generated HTML is checked explicitly after the documentation build.
- id: lychee-rendered
name: lychee (rendered documentation)
entry: python ./ci/tools/run_lychee.py --rendered
language: python
additional_dependencies: *lychee_dependencies
stages: [manual]
pass_filenames: false
always_run: true
args:
- --cache
- --max-cache-age=3d
- --max-concurrency=16
- --host-concurrency=2
- --host-request-interval=250ms
- --max-retries=3
- --retry-wait-time=5
- --timeout=30
- --no-progress
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0
hooks:
- id: check-added-large-files
exclude: cuda_bindings_13/cuda/bindings/nvml.pyx
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
exclude: &gen_exclude '^(?:cuda_python/README\.md|(?:.*/)?CLAUDE\.md|(?:.*/)?\.git_archival\.txt|cuda_bindings_13/cuda/bindings/.*\.in?|cuda_bindings_13/docs/source/module/.*\.rst?|.*\.pyi)$'
- id: mixed-line-ending
- id: trailing-whitespace
exclude: |
(?x)^(?:
cuda_python/README\.md|
cuda_bindings_13/cuda/bindings/.*\.in?|
cuda_bindings_13/docs/source/module/.*\.rst?|
.*\.patch$
)$
# Checking for common mistakes
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316" # frozen: v1.10.0
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 7ff8d35ae36a7d2b968f2f90b4c723e292e594ee # frozen: v2.3.1
hooks:
- id: mypy
alias: mypy-pathfinder
name: mypy-pathfinder
files: ^cuda_pathfinder/cuda/.*\.py$ # Exclude tests directory
args: [--config-file=cuda_pathfinder/pyproject.toml]
- id: mypy
alias: mypy-cuda-core
name: mypy-cuda-core
files: ^cuda_core/cuda/.*\.(py|pyi)$
exclude: ^cuda_core/cuda/core/_vendored/
pass_filenames: false
args: [--config-file=cuda_core/pyproject.toml, cuda_core/cuda/core]
additional_dependencies:
- numpy==2.4.2
- repo: https://github.com/rhysd/actionlint
rev: "914e7df21a07ef503a81201c76d2b11c789d3fca" # frozen: v1.7.12
hooks:
- id: actionlint
args: ["-shellcheck="]
exclude: ^\.github/workflows/coverage.yml$
- repo: https://github.com/MarcoGorelli/cython-lint
rev: "eb2f695bb80387913b8cb1f91ba7ff6cb3026715" # frozen: v0.21.1
hooks:
- id: cython-lint
args: [--no-pycodestyle]
exclude: ^cuda_bindings_13/
additional_dependencies:
- Cython==3.2.9
default_language_version:
python: python3