-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathconfig.yml
497 lines (465 loc) · 14.2 KB
/
config.yml
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
version: 2.1
orbs:
browser-tools: circleci/[email protected]
executors:
docker-container:
parameters:
python_version:
description: "python version"
default: "3.12"
type: string
docker:
- image: cimg/python:<<parameters.python_version>>-browsers
commands:
test_core:
steps:
- checkout
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run:
name: Install dependencies
command: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install .
uv pip install -r ./test_requirements/requirements_core.txt
- run:
name: List installed packages and python version
command: |
source .venv/bin/activate
uv pip list
python --version
- run:
name: Test core
command: |
source .venv/bin/activate
python -m pytest tests/test_core
no_output_timeout: 20m
test_optional:
parameters:
pandas_version:
type: string
numpy_version:
type: string
steps:
- checkout
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run:
name: Install dependencies
command: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install .
uv pip install -r ./test_requirements/requirements_optional.txt
cd js
npm ci
npm run build
- when:
condition:
not:
equal:
- <<parameters.pandas_version>>
- ""
steps:
- run:
name: Install pandas
command: |
source .venv/bin/activate
uv pip install pip
python -m pip install pandas==<<parameters.pandas_version>> numpy==<<parameters.numpy_version>>
- run:
name: Test core
command: |
source .venv/bin/activate
python -m pytest tests/test_core
no_output_timeout: 20m
- run:
name: List installed packages and python version
command: |
source .venv/bin/activate
uv pip list
python --version
- run:
name: Test optional
command: |
source .venv/bin/activate
python -m pytest tests/test_optional
no_output_timeout: 40m
- run:
name: Test utils
command: |
source .venv/bin/activate
python -m pytest tests/test_plotly_utils/
no_output_timeout: 20m
- run:
name: Test io
command: |
source .venv/bin/activate
python -m pytest tests/test_io
no_output_timeout: 20m
- run:
name: Test dependencies not imported
command: |
source .venv/bin/activate
python -m pytest -x test_init/test_dependencies_not_imported.py
- run:
name: Test lazy imports
command: |
source .venv/bin/activate
python -m pytest -x test_init/test_lazy_imports.py
test_io_kaleido_v1:
steps:
- checkout
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run:
name: Install dependencies
command: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install .
uv pip install -r ./test_requirements/requirements_optional.txt
# Install Kaleido v1 instead of the default version
uv pip uninstall -y kaleido
uv pip install 'git+https://github.com/plotly/[email protected]#subdirectory=src/py'
- run:
name: List installed packages and python version
command: |
source .venv/bin/activate
uv pip list
python --version
- run:
name: Test plotly.io with Kaleido v1
command: |
source .venv/bin/activate
python -m pytest tests/test_io
no_output_timeout: 20m
jobs:
check-code-formatting:
docker:
- image: cimg/python:3.12
steps:
- checkout
- run:
name: Install black
command: |
python -m venv venv
. venv/bin/activate
pip install black==22.3.0
- run:
name: Check formatting with black
command: |
. venv/bin/activate
black --check . --exclude venv
test_core_py:
parameters:
python_version:
default: "3.12"
type: string
executor:
name: docker-container
python_version: <<parameters.python_version>>
steps:
- test_core
test_optional_py:
parameters:
python_version:
default: "3.12"
type: string
pandas_version:
default: ""
type: string
numpy_version:
default: ""
type: string
executor:
name: docker-container
python_version: <<parameters.python_version>>
steps:
- test_optional:
pandas_version: <<parameters.pandas_version>>
numpy_version: <<parameters.numpy_version>>
test_kaleido_v1:
parameters:
python_version:
default: "3.12"
type: string
executor:
name: docker-container
python_version: <<parameters.python_version>>
steps:
- test_io_kaleido_v1
# Percy
python_311_percy:
docker:
- image: cimg/python:3.11-browsers
environment:
PERCY_ENABLED: True
PERCY_PROJECT: plotly/plotly.py
resource_class: large
steps:
- checkout
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run:
name: Inject Percy Environment variables
command: |
echo 'export PERCY_TOKEN="$PERCY_PYTHON_TOKEN_V0"' >> $BASH_ENV
- run:
name: Install requirements
command: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install -e .
uv pip install -r test_requirements/requirements_optional.txt
- run:
name: Build html figures (Pandas 2)
command: |
source .venv/bin/activate
python tests/percy/plotly-express.py
- run:
name: Build html figures (Pandas 1) and compare
command: |
source .venv/bin/activate
mkdir tests/percy/pandas2
mv tests/percy/*.html tests/percy/pandas2/
uv pip install pip
python -m pip install pandas==1.5.3 numpy==1.26.4
python tests/percy/plotly-express.py
python tests/percy/compare-pandas.py
rm -rf tests/percy/pandas2
- run:
name: List installed packages and python version
command: |
source .venv/bin/activate
uv pip list
python --version
- run:
name: Run percy snapshots
command: |
npm i @percy/cli
npx percy snapshot -c tests/percy/snapshots.yml tests/percy/
rm tests/percy/*.html
plotlyjs_dev_build:
docker:
- image: cimg/python:3.12-node
environment:
LANG: en_US.UTF-8
resource_class: large
steps:
- checkout
- run:
name: Install dependencies
command: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install -e .
uv pip install -r ./test_requirements/requirements_core.txt black inflect jupyterlab
- run:
name: Update plotly.js to dev
command: |
source .venv/bin/activate
python commands.py updateplotlyjsdev
- run:
name: Test core
command: |
source .venv/bin/activate
locale
pytest -k 'not nodev' tests/test_core
no_output_timeout: 20m
- run:
name: Build source distribution packages
command: |
source .venv/bin/activate
uv pip install build
python -m build --sdist --wheel -o dist
when: always
- store_artifacts:
path: dist/
full_build:
docker:
- image: cimg/python:3.12-node
environment:
LANG: en_US.UTF-8
resource_class: large
steps:
- checkout
- run:
name: initial NPM Build
command: |
python -m venv venv
. venv/bin/activate
cd js
npm ci
npm run build
git status
- run:
name: PyPI Build
command: |
. venv/bin/activate
pip install build
python -m build --sdist --wheel -o dist
cp -R dist output
git status
- run:
name: Zip output
command: |
tar czf output.tgz output
- store_artifacts:
path: output.tgz
build-doc:
resource_class: xlarge
docker:
- image: cimg/python:3.9-browsers
steps:
- add_ssh_keys:
fingerprints:
- "dc:5f:39:48:00:b4:72:34:e1:d2:c4:e1:1f:d1:e2:ce" #plotlydocbot
- checkout
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run:
name: Install dependencies
command: |
cd doc
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then
uv pip uninstall plotly
cd ..
uv pip install -e .
cd js
npm ci
npm run build
cd ../doc
fi
cd ..
- run:
name: make html
command: |
cd doc
source .venv/bin/activate
echo ${mapbox_token} > python/.mapbox_token
make -kj8 || make -kj8
curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/front-matter-ci.py > front-matter-ci.py
curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/check-or-enforce-order.py > check-or-enforce-order.py
python front-matter-ci.py build/html
python check-or-enforce-order.py build/html
if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then
cd build/html
git init
git config user.name plotlydocbot
git config user.email [email protected]
git add *
git commit -m "build of https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}"
git push --force [email protected]:plotly/plotly.py-docs.git master:built
rm -rf .git
cd ../..
cd build/ipynb
git init
git config user.name plotlydocbot
git config user.email [email protected]
git add *
git commit -m "build of https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}"
git push --force [email protected]:plotly/plotly.py-docs.git master:built_ipynb
rm -rf .git
cd ../..
fi
tar -zcf build/html.tgz build/html
rm -rf build/html build/ipynb
cd ..
- run:
name: trigger doc build
command: |
if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then
git clone --depth=1 https://github.com/plotly/graphing-library-docs.git
cd graphing-library-docs
git config user.name plotlydocbot
git config user.email [email protected]
git commit --allow-empty -m "deploying https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}"
git push
cd ..
rm -rf graphing-library-docs
fi
- run:
name: make doc
command: |
cd doc
source .venv/bin/activate
# For the API doc, we need to use the local version of plotly
# since we are tweaking the source because of
# graph_objs/graph_objects
if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then
uv pip uninstall plotly
cd ..
uv pip install -e .
cd doc
cd apidoc
make html
cd _build/html
touch .nojekyll
git init
git config user.name plotlydocbot
git config user.email [email protected]
git add *
git add .nojekyll
git commit -m "build of https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}"
git push --force [email protected]:plotly/plotly.py-docs.git master:gh-pages
rm -rf .git
cd ../..
fi
- store_artifacts:
path: doc/build
destination: doc/build
workflows:
code_formatting:
jobs:
- check-code-formatting
dev_build:
jobs:
- plotlyjs_dev_build
release_build:
jobs:
- full_build
build:
jobs:
- test_core_py:
matrix:
parameters:
python_version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- test_optional_py:
matrix:
parameters:
python_version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- test_optional_py:
name: "test_optional_py-3.9_pandas-1.2.4"
python_version: "3.9"
pandas_version: "1.2.4"
numpy_version: "1.26.4"
- test_kaleido_v1:
matrix:
parameters:
python_version:
- "3.12"
- python_311_percy
- build-doc