-
Notifications
You must be signed in to change notification settings - Fork 354
/
Copy pathtox.ini
345 lines (322 loc) · 11.6 KB
/
tox.ini
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
[tox]
isolated_build = True
skipsdist = True
[testenv]
package = wheel
wheel_build_env = .pkg
[testenv:phoenix_client]
description = Run tests for the arize-phoenix-client package
changedir = packages/phoenix-client/
deps =
-r requirements/packages/phoenix-client.txt
commands_pre = uv pip install --strict --reinstall-package arize-phoenix-client .
commands =
uv pip list -v
pyright .
mypy --strict .
[testenv:phoenix_client_canary_tests_sdk_openai]
description = Run phoenix-client canary tests for third-party SDK: anthropic
changedir = packages/phoenix-client/
setenv =
SDK = openai
MOD = chat
TESTS = tests/canary/sdk
HELPERS = src/phoenix/client/helpers/sdk
SDK_TESTS = {env:TESTS}/{env:SDK}
SDK_HELPERS = {env:HELPERS}/{env:SDK}
REQ = {toxinidir}/requirements
SDK_REQ = {env:REQ}/canary/sdk/{env:SDK}.txt
commands_pre =
uv pip install --strict -U --reinstall-package arize-phoenix-client .
uv pip uninstall -r {toxinidir}/requirements/canary/sdk/{env:SDK}.txt
uv pip list -v
commands =
python -c "import phoenix.client.helpers.sdk.{env:SDK}.{env:MOD}"
uv pip install --strict -U -r {env:REQ}/ci.txt
uv pip install --strict -U -r {env:SDK_REQ}
uv pip list -v
pyright -p {env:HELPERS}/pyrightconfig.json {env:SDK_HELPERS}
pyright -p {env:TESTS}/pyrightconfig.json {env:SDK_TESTS}
mypy --strict --follow-untyped-imports {env:SDK_HELPERS}/{env:MOD}.py
mypy --strict --follow-untyped-imports {env:SDK_TESTS}/test_{env:MOD}.py
pytest --disable-socket {posargs} {env:SDK_TESTS}
[testenv:phoenix_client_canary_tests_sdk_anthropic]
description = Run phoenix-client canary tests for third-party SDK: anthropic
changedir = packages/phoenix-client/
setenv =
SDK = anthropic
MOD = messages
TESTS = tests/canary/sdk
HELPERS = src/phoenix/client/helpers/sdk
SDK_TESTS = {env:TESTS}/{env:SDK}
SDK_HELPERS = {env:HELPERS}/{env:SDK}
REQ = {toxinidir}/requirements
SDK_REQ = {env:REQ}/canary/sdk/{env:SDK}.txt
commands_pre =
uv pip install --strict -U --reinstall-package arize-phoenix-client .
uv pip uninstall -r {toxinidir}/requirements/canary/sdk/{env:SDK}.txt
uv pip list -v
commands =
python -c "import phoenix.client.helpers.sdk.{env:SDK}.{env:MOD}"
uv pip install --strict -U -r {env:REQ}/ci.txt
uv pip install --strict -U -r {env:SDK_REQ}
uv pip list -v
pyright -p {env:HELPERS}/pyrightconfig.json {env:SDK_HELPERS}
pyright -p {env:TESTS}/pyrightconfig.json {env:SDK_TESTS}
mypy --strict --follow-untyped-imports {env:SDK_HELPERS}/{env:MOD}.py
mypy --strict --follow-untyped-imports {env:SDK_TESTS}/test_{env:MOD}.py
pytest --disable-socket {posargs} {env:SDK_TESTS}
[testenv:phoenix_client_canary_tests_sdk_google_generativeai]
description = Run phoenix-client canary tests for third-party SDK: google_generativeai
changedir = packages/phoenix-client/
setenv =
SDK = google_generativeai
MOD = generate_content
TESTS = tests/canary/sdk
HELPERS = src/phoenix/client/helpers/sdk
SDK_TESTS = {env:TESTS}/{env:SDK}
SDK_HELPERS = {env:HELPERS}/{env:SDK}
REQ = {toxinidir}/requirements
SDK_REQ = {env:REQ}/canary/sdk/{env:SDK}.txt
commands_pre =
uv pip install --strict -U --reinstall-package arize-phoenix-client .
uv pip uninstall -r {toxinidir}/requirements/canary/sdk/{env:SDK}.txt
uv pip list -v
commands =
python -c "import phoenix.client.helpers.sdk.{env:SDK}.{env:MOD}"
uv pip install --strict -U -r {env:REQ}/ci.txt
uv pip install --strict -U -r {env:SDK_REQ}
uv pip list -v
pyright -p {env:HELPERS}/pyrightconfig.json {env:SDK_HELPERS}
pyright -p {env:TESTS}/pyrightconfig.json {env:SDK_TESTS}
mypy --strict --follow-untyped-imports {env:SDK_HELPERS}/{env:MOD}.py
mypy --strict --follow-untyped-imports {env:SDK_TESTS}/test_{env:MOD}.py
pytest --disable-socket {posargs} {env:SDK_TESTS}
[testenv:phoenix_evals]
description = Run tests for the arize-phoenix-evals package
changedir = packages/phoenix-evals/
deps =
-r requirements/ci.txt
commands_pre = uv pip install --strict --reinstall-package arize-phoenix-evals .[test]
commands =
uv pip list -v
mypy .
pytest {posargs} .
[testenv:phoenix_otel]
description = Run tests for the arize-phoenix-otel package
changedir = packages/phoenix-otel/
deps =
-r requirements/ci.txt
commands_pre = uv pip install --strict --reinstall-package arize-phoenix-otel .[test]
commands =
uv pip list -v
mypy .
; pytest -ra -x {posargs:.}
[testenv:type_check_integration_tests]
description = Run type checking with mypy on integration tests
changedir = tests/integration
deps =
-r requirements/integration-tests.txt
commands_pre =
uv pip install --strict --reinstall-package arize-phoenix {toxinidir}
uv pip install --strict --reinstall-package arize-phoenix-client {toxinidir}/packages/phoenix-client
commands =
uv pip list -v
pyright -p pyrightconfig.json prompts/
mypy --strict .
[testenv:integration_tests]
description = Run integration tests
pass_env =
CI_TEST_DB_BACKEND
changedir = tests/integration
deps =
-r requirements/integration-tests.txt
commands_pre =
uv pip install --strict --reinstall-package arize-phoenix {toxinidir}
uv pip install --strict --reinstall-package arize-phoenix-client {toxinidir}/packages/phoenix-client
commands =
uv pip list -v
pytest {posargs} .
[testenv:type_check_unit_tests]
description = Run type checking with mypy on unit tests
changedir = tests/
deps =
-r requirements/unit-tests.txt
commands_pre =
uv pip install --strict --reinstall-package arize-phoenix {toxinidir}
commands =
uv pip list -v
mypy --strict unit/
[testenv:unit_tests]
description = Run unit tests
changedir = tests
deps =
-r requirements/unit-tests.txt
commands_pre =
uv pip install --strict --reinstall-package arize-phoenix {toxinidir}
commands =
uv pip list -v
pytest {posargs} unit/
[testenv:unit_tests_local_evals]
description = Run unit tests with phoenix-evals installed from local source
changedir = tests
deps =
-r requirements/unit-tests.txt
commands_pre =
uv pip install --strict --reinstall-package arize-phoenix --reinstall-package arize-phoenix-evals ../. arize-phoenix-evals@../packages/phoenix-evals
commands =
uv pip list -v
pytest {posargs} unit/
[testenv:type_check]
description = Run type checking with mypy on src/phoenix
deps =
-r requirements/type-check.txt
commands_pre =
uv pip install --strict --reinstall-package arize-phoenix .
uv pip install --strict --reinstall-package arize-phoenix-client {toxinidir}/packages/phoenix-client
commands =
uv pip list -v
mypy --strict src/phoenix/
[testenv:clean_jupyter_notebooks]
description = Clear output and metadata from Jupyter notebooks
deps =
-r requirements/clean-jupyter-notebooks.txt
commands =
uv pip list -v
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --ClearMetadataPreprocessor.enabled=True --inplace {posargs}
[testenv:build_graphql_schema]
description = Export GraphQL schema to a file (Python 3.9)
basepython = python3.9
changedir = app
deps =
-r requirements/build-graphql-schema.txt
commands_pre =
uv pip install --strict --reinstall-package arize-phoenix {toxinidir}
commands =
uv pip list -v
strawberry export-schema phoenix.server.api.schema:_EXPORTED_GRAPHQL_SCHEMA -o schema.graphql
[testenv:build_openapi_schema]
description = Export OpenAPI schema to a file (Python 3.9)
basepython = python3.9
changedir = schemas
commands_pre =
uv pip install --strict --reinstall-package arize-phoenix {toxinidir}
commands =
uv pip list -v
python -m phoenix.server.api.openapi.main -o openapi.json
[testenv:compile_protobuf]
description = Compile protobuf files (Python 3.9)
basepython = python3.9
deps =
-r requirements/compile-protobuf.txt
commands =
uv pip list -v
python -m grpc_tools.protoc -I src/phoenix/proto --python_out=src/phoenix --mypy_out=src/phoenix src/phoenix/proto/trace/v1/evaluation.proto
[testenv:add_symlinks]
description = Add symlinks to packages (for editable install)
changedir = src/phoenix
allowlist_externals =
sh
commands =
sh -c '[ -e client ] || ln -s ../../packages/phoenix-client/src/phoenix/client client'
sh -c '[ -e evals ] || ln -s ../../packages/phoenix-evals/src/phoenix/evals evals'
sh -c '[ -e otel ] || ln -s ../../packages/phoenix-otel/src/phoenix/otel otel'
[testenv:remove_symlinks]
description = Remove symlinks to packages
changedir = src/phoenix
allowlist_externals = find
commands =
find . -maxdepth 1 -type l -exec unlink {} \;
[testenv:phoenix_main]
description = Run Phoenix server
pass_env =
PHOENIX_PORT
PHOENIX_GRPC_PORT
PHOENIX_HOST_ROOT_PATH
PHOENIX_SQL_DATABASE_URL
PHOENIX_SQL_DATABASE_SCHEMA
PHOENIX_ENABLE_AUTH
PHOENIX_SECRET
PHOENIX_OAUTH2_GOOGLE_CLIENT_ID
PHOENIX_OAUTH2_GOOGLE_CLIENT_SECRET
PHOENIX_OAUTH2_GOOGLE_OIDC_CONFIG_URL
PHOENIX_OAUTH_GITHUB_CLIENT_ID
PHOENIX_OAUTH_GITHUB_CLIENT_SECRET
PHOENIX_OAUTH2_AUTH0_CLIENT_ID
PHOENIX_OAUTH2_AUTH0_CLIENT_SECRET
PHOENIX_OAUTH2_AUTH0_OIDC_CONFIG_URL
PHOENIX_OAUTH2_AZURE_AD_OIDC_CONFIG_URL
PHOENIX_OAUTH2_AZURE_AD_CLIENT_ID
PHOENIX_OAUTH2_AZURE_AD_CLIENT_SECRET
PHOENIX_OAUTH2_AWS_COGNITO_CLIENT_ID
PHOENIX_OAUTH2_AWS_COGNITO_CLIENT_SECRET
PHOENIX_OAUTH2_AWS_COGNITO_OIDC_CONFIG_URL
PHOENIX_SMTP_HOSTNAME
PHOENIX_SMTP_PORT
PHOENIX_SMTP_USERNAME
PHOENIX_SMTP_PASSWORD
PHOENIX_ACCESS_TOKEN_EXPIRY_MINUTES
commands_pre =
uv tool install -U --force arize-phoenix@. \
--reinstall-package arize-phoenix \
--with-requirements requirements/dev.txt \
--compile-bytecode
commands =
uv tool run arize-phoenix {posargs:serve}
[testenv:ruff]
description = Run ruff for formatting and linting
commands_pre =
uv tool install [email protected]
commands =
uv tool run ruff format
uv tool run ruff check --fix
[testenv:openapi_codegen_for_python_client]
description = Generate data models from OpenAPI schema for Python client
changedir = packages/phoenix-client/src/phoenix/client/__generated__/
commands_pre =
uv tool install [email protected]
commands =
uv pip list -v
python -c "import pathlib; pathlib.Path('v1/__init__.py').unlink(missing_ok=True)"
uv tool run --from datamodel-code-generator datamodel-codegen \
--input {toxinidir}/schemas/openapi.json \
--input-file-type openapi \
--output v1/.dataclass.txt \
--output-model-type dataclasses.dataclass \
--collapse-root-models \
--enum-field-as-literal all \
--target-python-version 3.9 \
--use-default-kwarg \
--use-double-quotes \
--use-generic-container-types \
--wrap-string-literal \
--disable-timestamp
python -c "import re; file = 'v1/.dataclass.txt'; lines = [re.sub(r'\\bSequence]', 'Sequence[Any]]', line) for line in open(file).readlines()]; open(file, 'w').writelines(lines)"
python {toxinidir}/packages/phoenix-client/scripts/codegen/transform.py v1
uv pip install --strict --reinstall-package arize-phoenix-client {toxinidir}/packages/phoenix-client
uv pip list -v
python -c "import phoenix.client.__generated__.v1"
uv tool run ruff format v1
uv tool run ruff check --fix v1
[testenv:graphql_codegen_for_python_tests]
description = Generate data models from GraphQL schema for Python tests
changedir = tests/__generated__/graphql/
commands =
uv pip list -v
python -c "import pathlib; pathlib.Path('__init__.py').unlink(missing_ok=True)"
uv tool run --from 'datamodel-code-generator[graphql]' datamodel-codegen \
--input {toxinidir}/app/schema.graphql \
--input-file-type graphql \
--output __init__.py \
--output-model-type pydantic_v2.BaseModel \
--collapse-root-models \
--enable-faux-immutability \
--enum-field-as-literal all \
--target-python-version 3.9 \
--use-default-kwarg \
--use-double-quotes \
--use-generic-container-types \
--use-standard-collections \
--wrap-string-literal \
--disable-timestamp
python __main__.py