Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
93 lines (92 loc) · 3.24 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
93 lines (92 loc) · 3.24 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
# Vendored bootstrap assets: never rewrite them.
exclude: ^static/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-toml
- id: check-yaml
# PEM and SSH key material, wherever it is pasted (certs/ is gitignored, but a
# key can still end up in a script or a config).
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.6
hooks:
- id: insert-license
name: Add license for all Python files
files: ^((llmao|tests|bin|hosting|analysis)/.*\.py$|api\.py$|main\.py$|pages\.py$)
args:
- --comment-style
- "|#|"
- --license-filepath
- LICENSE-template.txt
- --fuzzy-match-generates-todo
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.22.0
hooks:
- id: zizmor
args: [ --min-severity, low ]
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.26
hooks:
- id: uv-lock
- repo: local
hooks:
# Over the whole tree rather than the staged files: the scripts with a uv
# shebang are not identified as Python here, and ruff's extend-include in
# pyproject.toml is what knows them. Ruff is fast enough for that.
- id: ruff
name: Ruff Linter
entry: uv run ruff check --fix .
language: system
pass_filenames: false
always_run: true
- id: ruff-format
name: Ruff Formatter
entry: uv run ruff format .
language: system
pass_filenames: false
always_run: true
# The suite is fast, but not as fast as the hooks above, so it runs on push
# rather than every commit. Enable it with `prek install --hook-type pre-push`.
# Importing LiteLLM costs 8 s, so the tests that need it are keyed to the files
# that can change their outcome and run only when a push touches one of those.
# A uv.lock change runs them all, the ci_only tests included. CI runs everything.
- id: pytest
name: Run the test suite
entry: >-
uv run pytest -q -m "not ci_only"
--ignore tests/test_litellm_hooks.py
--ignore tests/test_models_yaml_litellm.py
language: system
stages: [pre-push]
pass_filenames: false
always_run: true
- id: pytest-litellm-hooks
name: Run the LiteLLM hook tests (the hook or the dependencies changed)
entry: uv run pytest -q tests/test_litellm_hooks.py
language: system
stages: [pre-push]
pass_filenames: false
files: ^(litellm_hooks\.py|tests/test_litellm_hooks\.py|uv\.lock)$
- id: pytest-models-yaml
name: Run the models.yaml checks against LiteLLM (the yaml or the dependencies changed)
entry: uv run pytest -q tests/test_models_yaml_litellm.py
language: system
stages: [pre-push]
pass_filenames: false
files: ^(models\.yaml|tests/test_models_yaml_litellm\.py|uv\.lock)$
- id: pytest-ci-only
name: Run the ci_only tests (the dependencies changed)
entry: uv run pytest -q -m ci_only
language: system
stages: [pre-push]
pass_filenames: false
files: ^uv\.lock$