forked from NVIDIA/cuda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
135 lines (122 loc) · 4.59 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
135 lines (122 loc) · 4.59 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
# 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]
submodules: false
# Please update the rev: SHAs below with this command:
# pre-commit autoupdate --freeze
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: c60c980e561ed3e73101667fe8365c609d19a438 # frozen: v0.15.9
hooks:
- id: ruff-check
args: [--fix, --show-fixes]
exclude: (^cuda_bindings/cuda/bindings/_internal/_fast_enum\.py$)|(.*\.pyi$)
- id: ruff-format
exclude: .*\.pyi$
- repo: local
hooks:
- 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$)'
args: ["--fix"]
- 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: 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.6
- Cython==3.2.4
# Link checking for authored documentation files
- repo: https://github.com/lycheeverse/lychee
rev: 2bba271688c1abb1503097a064e6c3bc1d1b6a9b # frozen: lychee-v0.24.2
hooks:
- id: lychee
args:
- --cache
- --max-concurrency=4
- --max-retries=3
- --no-progress
files: '\.(md|rst)$'
# 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/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|cuda_bindings/cuda/bindings/.*\.in?|cuda_bindings/docs/source/module/.*\.rst?|.*\.pyi)$'
- id: mixed-line-ending
- id: trailing-whitespace
exclude: |
(?x)^(?:
cuda_python/README\.md|
cuda_bindings/cuda/bindings/.*\.in?|
cuda_bindings/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: 8e5c80792e2ec0c87804d8ef915bf35e2caea6da # frozen: v1.20.0
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)$
pass_filenames: false
args: [--config-file=cuda_core/pyproject.toml, cuda_core/cuda/core]
additional_dependencies:
- numpy
- 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: "7c6152f6c8f9087684ff2e09a9227941e233bafb" # frozen: v0.19.0
hooks:
- id: cython-lint
args: [--no-pycodestyle]
exclude: ^cuda_bindings/
default_language_version:
python: python3