forked from tensorzero/tensorzero
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
185 lines (168 loc) · 5.79 KB
/
.pre-commit-config.yaml
File metadata and controls
185 lines (168 loc) · 5.79 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
args: ["--maxkb=1024"]
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
exclude: |
(?x)^(
examples/production-deployment-k8s-helm/templates/.*\.yaml
)$
- id: detect-private-key
exclude: |
(?x)^(
tensorzero-internal/src/inference/providers/gcp_vertex_gemini\.rs|
ci/dummy-gcp-credentials\.json
)$
- id: end-of-file-fixer
exclude: \.minijinja$
- id: trailing-whitespace
- repo: local
hooks:
# Find every pyproject.toml and generate a uv.lock file
- id: uv-lock
name: uv lock
entry: bash -c 'git ls-files "*.toml" "**/pyproject.toml" | grep -E "pyproject\.toml$" | while read f; do dir=$(dirname "$f"); echo "Locking $f"; (cd "$dir" && uv lock --project="pyproject.toml" && git add --intent-to-add "uv.lock"); done'
language: system
pass_filenames: false
always_run: true
# Find every pyproject.toml and generate a requirements.txt file
- id: uv-export
name: uv export
entry: bash -c 'git ls-files "*.toml" "**/pyproject.toml" | grep -E "pyproject\.toml$" | while read f; do dir=$(dirname "$f"); echo "Exporting $f"; (cd "$dir" && uv export --project="pyproject.toml" --output-file="requirements.txt" --quiet && git add --intent-to-add "requirements.txt"); done'
language: system
pass_filenames: false
always_run: true
- id: cargo-deny
name: cargo deny
entry: cargo deny check
language: system
types: [rust]
pass_filenames: false
- id: cargo-fmt
name: cargo fmt
entry: cargo fmt -- --check
language: system
types: [rust]
pass_filenames: false
- id: cargo-clippy
name: cargo clippy
entry: cargo clippy --all-targets --all-features -- -D warnings
language: system
types: [rust]
pass_filenames: false
- id: cargo-test-unit
name: cargo test-unit
entry: cargo test-unit
language: system
types: [rust]
pass_filenames: false
- id: "prettier: ui"
name: "prettier: ui"
entry: bash -c 'pnpm --filter=tensorzero-ui run format'
language: node
types_or:
[css, html, javascript, json, jsx, markdown, scss, ts, tsx, yaml]
additional_dependencies:
- prettier
- prettier-plugin-tailwindcss
- "@prettier/plugin-xml"
exclude: '.*\.ipynb$'
pass_filenames: false
- id: "prettier: openai-node"
name: "prettier: openai-node"
entry: bash -c 'pnpm --filter=openai-node run format'
language: node
types_or:
[css, html, javascript, json, jsx, markdown, scss, ts, tsx, yaml]
additional_dependencies:
- prettier
- prettier-plugin-tailwindcss
- "@prettier/plugin-xml"
exclude: '.*\.ipynb$'
pass_filenames: false
- id: "eslint: ui"
name: "eslint: ui"
entry: bash -c 'pnpm --filter=tensorzero-ui run lint'
language: node
types_or: [javascript, jsx, ts, tsx]
additional_dependencies:
- eslint
- "@typescript-eslint/parser"
- "@typescript-eslint/eslint-plugin"
pass_filenames: false
- id: "eslint: openai-node"
name: "eslint: openai-node"
entry: bash -c 'pnpm --filter=openai-node run lint'
language: node
types_or: [javascript, jsx, ts, tsx]
additional_dependencies:
- eslint
- "@typescript-eslint/parser"
- "@typescript-eslint/eslint-plugin"
pass_filenames: false
- id: "tsc: ui"
name: "tsc: ui"
entry: bash -c 'pnpm --filter=tensorzero-ui run typecheck'
language: node
types_or: [ts, tsx]
additional_dependencies:
- typescript
pass_filenames: false
- id: "tsc: openai-node"
name: "tsc: openai-node"
entry: bash -c 'pnpm --filter=openai-node run typecheck'
language: node
types_or: [ts, tsx]
additional_dependencies:
- typescript
pass_filenames: false
- id: compile-check-notebooks
name: compile-check-notebooks
entry: ci/compile-check-notebooks.sh all
language: system # run in the host environment (needs uvx)
# Restrict to files that matter so other commits don't pay the cost
files: ^recipes/.*(\.ipynb|_nb\.py)$
- repo: https://github.com/srstevenson/nb-clean
rev: 3.2.0
hooks:
- id: nb-clean
args:
- --remove-empty-cells
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.0
hooks:
- id: ruff
args: ["--extend-select", "I", "--fix"]
exclude: ^recipes/.*/_nb\.py$|^recipes/.*_nb\.py$
- id: ruff-format
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.391
hooks:
- id: pyright
name: "pyright: clients/openai-python"
files: ^clients/openai-python/
args: ["--project", "clients/openai-python/pyrightconfig.json"]
additional_dependencies:
- openai
- id: pyright
name: "pyright: recipes"
files: ^recipes/
args: ["--project", "recipes/pyrightconfig.json"]
additional_dependencies:
- clickhouse-connect
- pandas
- pandas-stubs
- pydantic
- tensorzero
- tiktoken
- toml