Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
89 lines (81 loc) · 3.48 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
89 lines (81 loc) · 3.48 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: ^(src/inference_endpoint/openai/openai_types_gen.py|src/inference_endpoint/openai/openapi.yaml|src/inference_endpoint/evaluation/legacy_mlperf_deepseek_r1/mlperf_eval/.*)$
- id: end-of-file-fixer
exclude: ^(src/inference_endpoint/evaluation/legacy_mlperf_deepseek_r1/mlperf_eval/.*)$
- id: check-yaml
- id: check-added-large-files
exclude: ^(src/inference_endpoint/openai/openai_types_gen.py|src/inference_endpoint/openai/openapi.yaml|docs/res/.*)$
- id: check-merge-conflict
- id: debug-statements
# TODO: sync rev with ruff version in pyproject.toml (currently 0.15.8)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
args: [--config-file=./pyproject.toml, src, tests]
pass_filenames: false
verbose: true
additional_dependencies:
- types-PyYAML==6.0.12
- types-requests>=2.32.4
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
# Markdown prose wraps at 80 columns via .prettierrc.yaml.
types_or: [yaml, json, markdown]
exclude: ^(src/inference_endpoint/openai/openai_types_gen.py|src/inference_endpoint/openai/openapi.yaml|src/inference_endpoint/config/templates/)
- repo: local
hooks:
- id: pytest-check
name: pytest
entry: pytest
language: system
pass_filenames: false
always_run: true
args: ["--tb=short", "--strict-markers"]
stages: [manual]
- id: regenerate-templates
name: Regenerate YAML templates from schema defaults
# uv pins the interpreter to this project's environment: a bare
# `python` resolves whatever is first on PATH, which can import
# inference_endpoint from a sibling checkout and regenerate the
# templates against the wrong schema.
entry: uv run --no-sync python scripts/regenerate_templates.py
language: system
pass_filenames: false
files: ^(src/inference_endpoint/config/(schema\.py|templates/.*)|src/inference_endpoint/endpoint_client/config\.py|scripts/regenerate_templates\.py)$
- id: add-license-header
name: Add license headers
entry: python scripts/add_license_header.py
language: system
types: [python]
pass_filenames: true
exclude: ^(src/inference_endpoint/openai/openai_types_gen.py|src/inference_endpoint/evaluation/legacy_mlperf_deepseek_r1/mlperf_eval/.*)$
- id: uv-lock-check
name: Check uv.lock is up-to-date
entry: uv lock --check
language: system
pass_filenames: false
files: ^(pyproject\.toml|uv\.lock)$
- id: pr-size-check
name: PR size (non-test churn class)
# Advisory: always exits 0. `verbose: true` makes pre-commit show the
# one-line size verdict on every commit (a passing hook's output is
# otherwise hidden). For the full threshold grid and per-class review
# requirements, run `python3 scripts/pr_size_check.py --verbose`.
entry: python3 scripts/pr_size_check.py
language: system
pass_filenames: false
always_run: true
verbose: true