Skip to content

Commit a09b2de

Browse files
authored
Merge branch 'main' into merge-doc-prod-changes-to-main
2 parents d293a45 + fbb65c8 commit a09b2de

File tree

14,989 files changed

+179086
-480661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

14,989 files changed

+179086
-480661
lines changed

.circleci/config.yml

Lines changed: 69 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ commands:
2525
curl -LsSf https://astral.sh/uv/install.sh | sh
2626
uv venv
2727
source .venv/bin/activate
28-
uv pip install .
29-
uv pip install -r ./test_requirements/requirements_core.txt
28+
uv lock --check
29+
uv sync --extra dev_core
3030
- run:
3131
name: List installed packages and python version
3232
command: |
@@ -56,11 +56,7 @@ commands:
5656
curl -LsSf https://astral.sh/uv/install.sh | sh
5757
uv venv
5858
source .venv/bin/activate
59-
uv pip install .
60-
uv pip install -r ./test_requirements/requirements_optional.txt
61-
cd js
62-
npm ci
63-
npm run build
59+
uv sync --extra dev_optional
6460
6561
- when:
6662
condition:
@@ -73,8 +69,7 @@ commands:
7369
name: Install pandas
7470
command: |
7571
source .venv/bin/activate
76-
uv pip install pip
77-
python -m pip install pandas==<<parameters.pandas_version>> numpy==<<parameters.numpy_version>>
72+
uv pip install pandas==<<parameters.pandas_version>> numpy==<<parameters.numpy_version>>
7873
7974
- run:
8075
name: Test core
@@ -117,6 +112,34 @@ commands:
117112
source .venv/bin/activate
118113
python -m pytest -x test_init/test_lazy_imports.py
119114
115+
test_io_kaleido_v0:
116+
steps:
117+
- checkout
118+
- browser-tools/install-chrome
119+
- browser-tools/install-chromedriver
120+
- run:
121+
name: Install dependencies
122+
command: |
123+
curl -LsSf https://astral.sh/uv/install.sh | sh
124+
uv venv
125+
source .venv/bin/activate
126+
uv sync --extra dev_optional
127+
# Install Kaleido v0 instead of the v1 specified in requirements_optional.txt
128+
uv pip uninstall kaleido
129+
uv pip install kaleido==0.2.1
130+
- run:
131+
name: List installed packages and python version
132+
command: |
133+
source .venv/bin/activate
134+
uv pip list
135+
python --version
136+
- run:
137+
name: Test plotly.io image output with Kaleido v0
138+
command: |
139+
source .venv/bin/activate
140+
python -m pytest tests/test_optional/test_kaleido
141+
no_output_timeout: 20m
142+
120143
jobs:
121144
check-code-formatting:
122145
docker:
@@ -125,16 +148,16 @@ jobs:
125148
steps:
126149
- checkout
127150
- run:
128-
name: Install black
151+
name: Install ruff
129152
command: |
130-
python -m venv venv
131-
. venv/bin/activate
132-
pip install black==22.3.0
153+
uv venv
154+
source .venv/bin/activate
155+
uv sync --extra dev_core
133156
- run:
134-
name: Check formatting with black
157+
name: Check handwritten code with ruff
135158
command: |
136-
. venv/bin/activate
137-
black --check . --exclude venv
159+
source .venv/bin/activate
160+
ruff format --check .
138161
139162
test_core_py:
140163
parameters:
@@ -166,6 +189,17 @@ jobs:
166189
pandas_version: <<parameters.pandas_version>>
167190
numpy_version: <<parameters.numpy_version>>
168191

192+
test_kaleido_v0:
193+
parameters:
194+
python_version:
195+
default: "3.12"
196+
type: string
197+
executor:
198+
name: docker-container
199+
python_version: <<parameters.python_version>>
200+
steps:
201+
- test_io_kaleido_v0
202+
169203
# Percy
170204
python_311_percy:
171205
docker:
@@ -189,22 +223,20 @@ jobs:
189223
curl -LsSf https://astral.sh/uv/install.sh | sh
190224
uv venv
191225
source .venv/bin/activate
192-
uv pip install -e .
193-
uv pip install -r test_requirements/requirements_optional.txt
226+
uv sync --extra dev_optional
194227
195228
- run:
196-
name: Build html figures (Pandas 2)
229+
name: Build HTML figures (Pandas 2)
197230
command: |
198231
source .venv/bin/activate
199232
python tests/percy/plotly-express.py
200233
- run:
201-
name: Build html figures (Pandas 1) and compare
234+
name: Build HTML figures (Pandas 1) and compare
202235
command: |
203236
source .venv/bin/activate
204237
mkdir tests/percy/pandas2
205238
mv tests/percy/*.html tests/percy/pandas2/
206-
uv pip install pip
207-
python -m pip install pandas==1.5.3 numpy==1.26.4
239+
uv pip install pandas==1.5.3 numpy==1.26.4
208240
python tests/percy/plotly-express.py
209241
python tests/percy/compare-pandas.py
210242
rm -rf tests/percy/pandas2
@@ -236,8 +268,7 @@ jobs:
236268
curl -LsSf https://astral.sh/uv/install.sh | sh
237269
uv venv
238270
source .venv/bin/activate
239-
uv pip install -e .
240-
uv pip install -r ./test_requirements/requirements_core.txt black inflect jupyterlab
271+
uv sync --extra dev_optional
241272
- run:
242273
name: Update plotly.js to dev
243274
command: |
@@ -254,7 +285,7 @@ jobs:
254285
name: Build source distribution packages
255286
command: |
256287
source .venv/bin/activate
257-
uv pip install build
288+
uv sync --extra dev_build
258289
python -m build --sdist --wheel -o dist
259290
when: always
260291
- store_artifacts:
@@ -269,22 +300,17 @@ jobs:
269300

270301
steps:
271302
- checkout
272-
273303
- run:
274-
name: initial NPM Build
304+
name: PyPI Build
275305
command: |
276-
python -m venv venv
277-
. venv/bin/activate
306+
curl -LsSf https://astral.sh/uv/install.sh | sh
307+
uv venv
308+
source .venv/bin/activate
309+
uv sync --extra dev_build
278310
cd js
279311
npm ci
280312
npm run build
281-
git status
282-
283-
- run:
284-
name: PyPI Build
285-
command: |
286-
. venv/bin/activate
287-
pip install build
313+
cd ..
288314
python -m build --sdist --wheel -o dist
289315
cp -R dist output
290316
git status
@@ -310,7 +336,6 @@ jobs:
310336
- checkout
311337
- browser-tools/install-chrome
312338
- browser-tools/install-chromedriver
313-
314339
- run:
315340
name: Install dependencies
316341
command: |
@@ -321,16 +346,11 @@ jobs:
321346
uv venv
322347
source .venv/bin/activate
323348
uv pip install -r requirements.txt
349+
cd ..
324350
if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then
325351
uv pip uninstall plotly
326-
cd ..
327352
uv pip install -e .
328-
cd js
329-
npm ci
330-
npm run build
331-
cd ../doc
332353
fi
333-
cd ..
334354
335355
- run:
336356
name: make html
@@ -412,6 +432,7 @@ jobs:
412432
- store_artifacts:
413433
path: doc/build
414434
destination: doc/build
435+
415436
workflows:
416437
code_formatting:
417438
jobs:
@@ -422,7 +443,6 @@ workflows:
422443
release_build:
423444
jobs:
424445
- full_build
425-
426446
build:
427447
jobs:
428448
- test_core_py:
@@ -450,5 +470,10 @@ workflows:
450470
python_version: "3.9"
451471
pandas_version: "1.2.4"
452472
numpy_version: "1.26.4"
473+
- test_kaleido_v0:
474+
matrix:
475+
parameters:
476+
python_version:
477+
- "3.12"
453478
- python_311_percy
454479
- build-doc

.github/ISSUE_TEMPLATE.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
Thanks for your interest in Plotly.py!
1+
Thanks for your interest in Plotly.py.
2+
Before opening an issue, please:
23

3-
Before opening an issue, please search for existing and closed issues :)
4+
- Use the [latest version](https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md) of plotly.py in your report unless not applicable.
5+
- Search for existing and closed issues.
6+
- Include a minimal reproducible example with bug reports.
47

5-
**Please** accompany bug reports with a reproducible example. Please use the [latest version](https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md) of plotly.py in your report unless not applicable.
6-
7-
Note that GitHub Issues are meant to be used for bug reports and feature requests only. Implementation or usage questions should be asked on [community.plotly.com](https://community.plotly.com/c/graphing-libraries/python/10) or on Stack Overflow (tagged [`plotly`](https://stackoverflow.com/questions/tagged/plotly)).
8+
Note that GitHub Issues are meant to be used for bug reports and feature requests.
9+
Questions about usage should be asked on [community.plotly.com](https://community.plotly.com/c/graphing-libraries/python/10).

.github/pull_request_template.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
<!--
2-
Please uncomment this block and take a look at this checklist if your PR is making substantial changes to **documentation**/impacts files in the `doc` directory. Check all that apply to your PR, and leave the rest unchecked to discuss with your reviewer! Not all boxes must be checked for every PR :)
2+
Please uncomment this block and fill in this checklist if your PR makes substantial changes to documentation in the `doc` directory.
3+
Not all boxes must be checked for every PR:
4+
check those that apply to your PR and leave the rest unchecked to discuss with your reviewer.
35
4-
If your PR modifies code of the `plotly` package, we have a different checklist
5-
below :-).
6+
If your PR modifies code of the `plotly` package, we have a different checklist below.
67
7-
### Documentation PR
8+
## Documentation PR
89
9-
- [ ] I've [seen the `doc/README.md` file](https://github.com/plotly/plotly.py/blob/master/doc/README.md)
10-
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch
11-
- [ ] If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible
12-
- [ ] Every new/modified example has a descriptive title and motivating sentence or paragraph
13-
- [ ] Every new/modified example is independently runnable
14-
- [ ] Every new/modified example is optimized for short line count and focuses on the Plotly/visualization-related aspects of the example rather than the computation required to produce the data being visualized
15-
- [ ] Meaningful/relatable datasets are used for all new examples instead of randomly-generated data where possible
16-
- [ ] The random seed is set if using randomly-generated data in new/modified examples
17-
- [ ] New/modified remote datasets are loaded from https://plotly.github.io/datasets and added to https://github.com/plotly/datasets
18-
- [ ] Large computations are avoided in the new/modified examples in favour of loading remote datasets that represent the output of such computations
19-
- [ ] Imports are `plotly.graph_objects as go` / `plotly.express as px` / `plotly.io as pio`
20-
- [ ] Data frames are always called `df`
21-
- [ ] `fig = <something>` call is high up in each new/modified example (either `px.<something>` or `make_subplots` or `go.Figure`)
22-
- [ ] Liberal use is made of `fig.add_*` and `fig.update_*` rather than `go.Figure(data=..., layout=...)` in every new/modified example
23-
- [ ] Specific adders and updaters like `fig.add_shape` and `fig.update_xaxes` are used instead of big `fig.update_layout` calls in every new/modified example
24-
- [ ] `fig.show()` is at the end of each new/modified example
25-
- [ ] `plotly.plot()` and `plotly.iplot()` are not used in any new/modified example
26-
- [ ] Hex codes for colors are not used in any new/modified example in favour of [these nice ones](https://github.com/plotly/plotly.py/issues/2192)
10+
- [ ] I have seen the [`doc/README.md`](https://github.com/plotly/plotly.py/blob/main/doc/README.md) file.
11+
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch.
12+
- [ ] If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible.
13+
- [ ] Every new/modified example has a descriptive title and motivating sentence or paragraph.
14+
- [ ] Every new/modified example is independently runnable.
15+
- [ ] Every new/modified example is optimized for short line count and focuses on the Plotly/visualization-related aspects of the example rather than the computation required to produce the data being visualized.
16+
- [ ] Meaningful/relatable datasets are used for all new examples instead of randomly-generated data where possible.
17+
- [ ] The random seed is set if using randomly-generated data.
18+
- [ ] New/modified remote datasets are loaded from https://plotly.github.io/datasets and added to https://github.com/plotly/datasets.
19+
- [ ] Large computations are avoided in the new/modified examples in favour of loading remote datasets that represent the output of such computations.
20+
- [ ] Imports are `plotly.graph_objects as go`, `plotly.express as px`, and/or `plotly.io as pio`.
21+
- [ ] Data frames are always called `df`.
22+
- [ ] `fig = <something>` is called high up in each new/modified example (either `px.<something>` or `make_subplots` or `go.Figure`).
23+
- [ ] Liberal use is made of `fig.add_*` and `fig.update_*` rather than `go.Figure(data=..., layout=...)`.
24+
- [ ] Specific adders and updaters like `fig.add_shape` and `fig.update_xaxes` are used instead of big `fig.update_layout` calls.
25+
- [ ] `fig.show()` is at the end of each example.
26+
- [ ] `plotly.plot()` and `plotly.iplot()` are not used in any example.
27+
- [ ] Named colors are used instead of hex codes wherever possible.
28+
- [ ] Code blocks are marked with `&#96;&#96;&#96;python`.
2729
2830
## Code PR
2931
30-
- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/master/CONTRIBUTING.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the `codegen` files and not generated files.
31-
- [ ] I have added tests (if submitting a new feature or correcting a bug) or
32-
modified existing tests.
33-
- [ ] For a new feature, I have added documentation examples in an existing or
34-
new tutorial notebook (please see the doc checklist as well).
35-
- [ ] I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
36-
- [ ] For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).
32+
- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/main/CONTRIBUTING.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the code generator and *not* the generated files.
33+
- [ ] I have added tests or modified existing tests.
34+
- [ ] For a new feature, I have added documentation examples (please see the doc checklist as well).
35+
- [ ] I have added a CHANGELOG entry if changing anything substantial.
36+
- [ ] For a new feature or a change in behavior, I have updated the relevant docstrings in the code.
3737
3838
-->

.github/workflows/check-js-build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
on: push
2+
3+
jobs:
4+
check-js-build:
5+
name: Check JS build artifacts
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Set up Python
10+
uses: actions/setup-python@v5
11+
with:
12+
python-version: "3.x"
13+
14+
- name: Install Node
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: '22'
18+
19+
- name: Copy current files to a temporary directory
20+
run: |
21+
cp -R plotly/labextension/ plotly/labextension-tmp/
22+
23+
- name: Install dependencies and build
24+
run: |
25+
curl -LsSf https://astral.sh/uv/install.sh | sh
26+
uv venv
27+
source .venv/bin/activate
28+
uv pip install jupyter
29+
cd js
30+
npm ci
31+
npm run build
32+
- name: Check JupyterLab build artifacts
33+
run: |
34+
# 1. Hash contents of all static files, sort by content hash
35+
find plotly/labextension/static -type f -exec sha256sum {} \; | awk '{print $1}' | sort > new_hashes.txt
36+
find plotly/labextension-tmp/static -type f -exec sha256sum {} \; | awk '{print $1}' | sort > old_hashes.txt
37+
38+
# 2. Compare the sorted content hashes
39+
diff old_hashes.txt new_hashes.txt > content_diff.txt
40+
41+
# Remove the "load" line from both package.json files before comparing
42+
grep -v '"load": "static/' plotly/labextension/package.json > pkg1.json
43+
grep -v '"load": "static/' plotly/labextension-tmp/package.json > pkg2.json
44+
45+
# Compare stripped versions
46+
diff pkg1.json pkg2.json > package_json_diff.txt
47+
48+
# 5. Final check
49+
if [ -s content_diff.txt ] || [ -s package_json_diff.txt ]; then
50+
echo "❌ Build artifacts differ:"
51+
echo "--- Unexpected diffs ---"
52+
cat content_diff.txt
53+
echo "--- Unexpected package.json diffs ---"
54+
cat package_json_diff.txt
55+
echo "Please replace the 'plotly/labextension' directory with the artifacts of this CI run."
56+
exit 1
57+
else
58+
echo "✅ Build artifacts match expected output (ignoring known 'load' hash in package.json)."
59+
fi
60+
61+
- name: Store the build artifacts from plotly/labextension
62+
uses: actions/upload-artifact@v4
63+
if: failure()
64+
with:
65+
name: labextension
66+
path: plotly/labextension

0 commit comments

Comments
 (0)