Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
128 lines (118 loc) · 5.06 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
128 lines (118 loc) · 5.06 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
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
# All rights reserved.
# SPDX-License-Identifier: Apache-2.0
default_language_version:
python: python3.11
repos:
# The SDK retains its standalone tool versions and policy in
# packages/kumo-sdk/.pre-commit-config.yaml; package CI runs it separately.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: no-commit-to-branch
args: ['--branch', 'master']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: end-of-file-fixer
exclude: ^(packages/(diskgraph|kumo-ui-catalog)/)
- id: trailing-whitespace
exclude: ^(packages/(diskgraph|kumo-ui-catalog)/|THIRD-PARTY\.txt)
- id: check-yaml
exclude: ^helm/kumo-helm/(templates/|examples/)
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.26.3
hooks:
- id: yamllint
args: [-c=.yamllint.yml]
exclude: ^packages/kumo-ui-catalog/
- repo: https://github.com/regebro/pyroma
rev: '5.0'
hooks:
- id: pyroma
name: Check packaging
args: [--min=9, .]
additional_dependencies: ["setuptools-scm[toml]==8.3.1"]
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
name: Remove unused imports and variables
exclude: ^(kumo/pquery/grammar/|packages/(diskgraph/|kumo-(api|core|sdk)/))
args: [
--remove-all-unused-imports,
--remove-unused-variables,
--remove-duplicate-keys,
--in-place,
]
- repo: https://github.com/google/yapf
rev: v0.40.2
hooks:
- id: yapf
name: Format code
exclude: ^(kumo/pquery/grammar/|packages/(diskgraph/|kumo-(api|core|sdk)/))
additional_dependencies: ["toml>=0.10.2"]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: Sort imports
exclude: ^(kumo/pquery/grammar/|packages/(diskgraph/|kumo-(api|core|sdk)/))
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
name: Check PEP8
exclude: ^(kumo/pquery/grammar/|packages/(diskgraph/|kumo-(api|core|sdk)/))
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.283
hooks:
- id: pyright
name: pyright
entry: env PYRIGHT_PYTHON_GLOBAL_NODE=0 env PYRIGHT_PYTHON_ENV_DIR=.nodeenv pyright -p precommit-pyrightconfig.json
require_serial: true
pass_filenames: false
files: '.*\.py'
additional_dependencies: [kubernetes-stubs]
- repo: local
hooks:
- id: license-headers
name: Check source license headers
entry: python3 scripts/check_license_headers.py
language: system
pass_filenames: false
- id: python-license-metadata
name: Check Python license metadata
entry: python scripts/check_python_license_metadata.py
language: python
additional_dependencies: ["tomli==2.2.1; python_version < '3.11'"]
pass_filenames: false
- id: third-party-notice
name: third-party notice freshness and policy
entry: python3 scripts/gen_third_party.py --check THIRD-PARTY.txt
language: system
pass_filenames: false
files: ^(THIRD-PARTY\.txt|3rdparty/BUILD|3rdparty/kumo-wheels/|3rdparty/notices/|packages/diskgraph/(Cargo\.lock|diskgraph-ptrhash/|scripts/generate_artifact_manifest\.py|third_party/(artifact-manifest|source-provenance)\.json)|packages/kumo-core/src/kumo_core/evaluation/distribution\.py|packages/kumo-engine/scripts/(build_wheel\.sh|merge_wheels\.py)|scripts/gen_third_party\.py|tools/glove-6b-50d/(build_wheel\.sh|pyproject\.toml))
- id: lint-staged
name: ui-lint-staged
entry: bash -c 'cd ui/ && npx lint-staged --config package.json --allow-empty'
language: system
pass_filenames: false
- repo: https://github.com/lk16/detect-missing-init
rev: v0.1.6
hooks:
- id: detect-missing-init
# kumo/ is deliberately excluded: it lost its own __init__.py (and so
# did kumo/engine/) to become a shared PEP 420 namespace package with
# packages/kumo-engine's kumo.engine (see setup.py's comment on this).
# tools/ is scoped to tools/ci rather than the whole tree: tools/
# glove-6b-50d is its own first-party distribution with a src/
# layout and no explicit `where=["src"]` in its pyproject.toml, so
# adding __init__.py under tools/glove-6b-50d/ (this hook's fix)
# makes setuptools bundle a stray top-level __init__.py into its
# wheel -- reproduced locally with a clean build. This hook has no
# per-path ignore, only this flat folder list, so scoping down is
# the only way to keep both exclusions working; confirmed both
# false positives against a pristine master checkout, unrelated to
# any specific PR's changes.
args: ['--create', "--track", "--python-folders", "async_utils,io_utils,rest,scripts,statedb,test,temporalio_commons,tools/ci"]