Skip to content

Commit ee1ca32

Browse files
committed
Enable pre-commit checks for the integrated CUDA 12 source
Signed-off-by: Ralf W. Grosse-Kunstleve <[email protected]>
1 parent 33c8f4f commit ee1ca32

5 files changed

Lines changed: 24 additions & 19 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ ci:
1414

1515
# Please update the rev: SHAs below with this command:
1616
# pre-commit autoupdate --freeze
17-
# This unchanged maintenance-source import is inactive until its integration layer.
18-
exclude: ^cuda_bindings_12/
19-
2017
repos:
2118
# Runs first so a leaked credential blocks the commit before any formatter runs.
2219
# Self-installing: the hook downloads a pinned, checksum-verified trufflehog on
@@ -31,7 +28,7 @@ repos:
3128
hooks:
3229
- id: ruff-check
3330
args: [--fix, --show-fixes]
34-
exclude: (^cuda_bindings_13/cuda/bindings/_internal/_fast_enum\.py$)|(.*\.pyi$)
31+
exclude: (^cuda_bindings_(?:12|13)/cuda/bindings/_internal/_fast_enum\.py$)|(.*\.pyi$)
3532
- id: ruff-format
3633
exclude: .*\.pyi$
3734

@@ -71,7 +68,7 @@ repos:
7168
name: Check generated-file seals
7269
entry: python ./toolshed/check_generated_file_seals.py
7370
language: python
74-
files: ^cuda_bindings_13/
71+
files: ^cuda_bindings_(?:12|13)/
7572
types: [text]
7673

7774
- id: check-pixi-cuda-version
@@ -96,6 +93,9 @@ repos:
9693
- "_" # fake script name, because bash considers $0 (the first argument) to be the script name
9794
language: system
9895
files: '^.*/docs/source/.*\.md$'
96+
# The imported CUDA 12.9 documentation retains its historical MyST
97+
# sources; new documentation elsewhere must continue to use reST.
98+
exclude: '^cuda_bindings_12/docs/source/'
9999

100100
- id: stubgen-pyx-cuda-core
101101
name: Generate .pyi stubs for cuda_core
@@ -155,7 +155,7 @@ repos:
155155
rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0
156156
hooks:
157157
- id: check-added-large-files
158-
exclude: cuda_bindings_13/cuda/bindings/nvml.pyx
158+
exclude: '^(?:cuda_bindings_13/cuda/bindings/nvml\.pyx|cuda_bindings_12/cuda/bindings/(?:driver\.pyx|runtime\.pyx\.in|nvml\.pyx))$'
159159
- id: check-case-conflict
160160
- id: check-docstring-first
161161
- id: check-merge-conflict
@@ -164,14 +164,14 @@ repos:
164164
- id: check-yaml
165165
- id: debug-statements
166166
- id: end-of-file-fixer
167-
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)$'
167+
exclude: &gen_exclude '^(?:cuda_python/README\.md|(?:.*/)?CLAUDE\.md|(?:.*/)?\.git_archival\.txt|cuda_bindings_(?:12|13)/cuda/bindings/.*\.in?|cuda_bindings_(?:12|13)/docs/source/module/.*\.rst?|.*\.pyi)$'
168168
- id: mixed-line-ending
169169
- id: trailing-whitespace
170170
exclude: |
171171
(?x)^(?:
172172
cuda_python/README\.md|
173-
cuda_bindings_13/cuda/bindings/.*\.in?|
174-
cuda_bindings_13/docs/source/module/.*\.rst?|
173+
cuda_bindings_(?:12|13)/cuda/bindings/.*\.in?|
174+
cuda_bindings_(?:12|13)/docs/source/module/.*\.rst?|
175175
.*\.patch$
176176
)$
177177
@@ -213,7 +213,7 @@ repos:
213213
hooks:
214214
- id: cython-lint
215215
args: [--no-pycodestyle]
216-
exclude: ^cuda_bindings_13/
216+
exclude: ^cuda_bindings_(?:12|13)/
217217
additional_dependencies:
218218
- Cython==3.2.9
219219

‎cuda_bindings_12/pyproject.toml‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
[build-system]
55
requires = [
6-
"setuptools>=80.0.0",
6+
"setuptools>=80.0.0",
77
"setuptools-scm[simple]>=8",
8-
"cython>=3.2,<3.3",
8+
"cython>=3.2,<3.3",
99
"pyclibrary>=0.1.7"
1010
]
1111
build-backend = "build_hooks"
@@ -93,25 +93,29 @@ select = [
9393
]
9494

9595
ignore = [
96-
"UP007",
96+
"UP007",
9797
"E741", # ambiguous variable name such as I
98-
"B007", # rename unsued loop variable to _name
99-
"UP035" # UP006, UP007, UP035 complain about deprecated Typing.<type> use, but disregard backward compatibility of python version
98+
"B007", # rename unsued loop variable to _name
99+
"UP035", # UP006, UP007, UP035 complain about deprecated Typing.<type> use, but disregard backward compatibility of python version
100+
"B905", # preserve the imported line's zip() behavior
101+
"I001", # preserve generated and legacy import ordering
100102
]
101103

102104
exclude = ["cuda/bindings/_version.py"]
103105

104106
[tool.ruff.lint.per-file-ignores]
105107
"setup.py" = ["F401"]
106108
"__init__.py" = ["F401"]
109+
"site-packages/_cuda_bindings_redirector.py" = ["F401"]
110+
"cuda/bindings/_internal/_fast_enum.py" = ["E501"]
107111

108112
"examples/**/*" = [
109113
"E722",
110114
"E501" # line too long
111115
]
112116

113117
"tests/**/*" = [
114-
"E722",
118+
"E722",
115119
"UP022",
116120
"E402", # module level import not at top of file
117121
"F841"] # F841 complains about unused variables, but some assignments have side-effects that could be useful for tests (func calls for example)

‎ruff.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ inline-quotes = "double"
140140

141141
# CUDA bindings mirror C API naming conventions (CamelCase types, camelCase functions)
142142
# Keep examples opted-in to enforce naming conventions in example-local identifiers.
143-
"cuda_bindings_13/{cuda,docs,tests}/**" = [
143+
"{cuda_bindings_12,cuda_bindings_13}/{cuda,docs,tests}/**" = [
144144
"N801", # invalid-class-name
145145
"N802", # invalid-function-name
146146
"N803", # invalid-argument-name
@@ -152,7 +152,7 @@ inline-quotes = "double"
152152
"N802", # invalid-function-name
153153
"N806", # non-lowercase-variable-in-function
154154
]
155-
"cuda_bindings_13/{build_hooks.py,setup.py}" = ["N801", "N802", "N803", "N806", "N816"]
155+
"{cuda_bindings_12,cuda_bindings_13}/{build_hooks.py,setup.py}" = ["N801", "N802", "N803", "N806", "N816"]
156156

157157
# scripts and build tooling — print is the expected output method
158158
"qa/**" = ["T201"]

‎toolshed/check_generated_file_seals.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def load_previously_sealed_paths():
6262
GENERATED_FILE_MARKER_FRAGMENT,
6363
"HEAD",
6464
"--",
65-
"cuda_bindings_13",
65+
":(glob)cuda_bindings_[0-9]*/**",
6666
],
6767
capture_output=True,
6868
text=True,

‎toolshed/check_spdx.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"benchmarks": "Apache-2.0",
2727
"ci": "Apache-2.0",
2828
"cuda_bindings_13": "Apache-2.0",
29+
"cuda_bindings_12": "Apache-2.0",
2930
"cuda_core": "Apache-2.0",
3031
"cuda_pathfinder": "Apache-2.0",
3132
"cuda_python": "Apache-2.0",

0 commit comments

Comments
 (0)