Skip to content

Commit 0e20fff

Browse files
authored
Merge branch 'main' into updates-for-main
2 parents 0026a09 + f70d8bf commit 0e20fff

File tree

14,877 files changed

+156039
-352845
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,877 files changed

+156039
-352845
lines changed

.circleci/config.yml

+56-24
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ commands:
5858
source .venv/bin/activate
5959
uv pip install .
6060
uv pip install -r ./test_requirements/requirements_optional.txt
61-
cd js
62-
npm ci
63-
npm run build
6461
6562
- when:
6663
condition:
@@ -117,6 +114,35 @@ commands:
117114
source .venv/bin/activate
118115
python -m pytest -x test_init/test_lazy_imports.py
119116
117+
test_io_kaleido_v0:
118+
steps:
119+
- checkout
120+
- browser-tools/install-chrome
121+
- browser-tools/install-chromedriver
122+
- run:
123+
name: Install dependencies
124+
command: |
125+
curl -LsSf https://astral.sh/uv/install.sh | sh
126+
uv venv
127+
source .venv/bin/activate
128+
uv pip install .
129+
uv pip install -r ./test_requirements/requirements_optional.txt
130+
# Install Kaleido v0 instead of the v1 specified in requirements_optional.txt
131+
uv pip uninstall kaleido
132+
uv pip install kaleido==0.2.1
133+
- run:
134+
name: List installed packages and python version
135+
command: |
136+
source .venv/bin/activate
137+
uv pip list
138+
python --version
139+
- run:
140+
name: Test plotly.io image output with Kaleido v0
141+
command: |
142+
source .venv/bin/activate
143+
python -m pytest tests/test_optional/test_kaleido
144+
no_output_timeout: 20m
145+
120146
jobs:
121147
check-code-formatting:
122148
docker:
@@ -129,7 +155,7 @@ jobs:
129155
command: |
130156
python -m venv venv
131157
. venv/bin/activate
132-
pip install black==22.3.0
158+
pip install black==25.1.0
133159
- run:
134160
name: Check formatting with black
135161
command: |
@@ -166,6 +192,17 @@ jobs:
166192
pandas_version: <<parameters.pandas_version>>
167193
numpy_version: <<parameters.numpy_version>>
168194

195+
test_kaleido_v0:
196+
parameters:
197+
python_version:
198+
default: "3.12"
199+
type: string
200+
executor:
201+
name: docker-container
202+
python_version: <<parameters.python_version>>
203+
steps:
204+
- test_io_kaleido_v0
205+
169206
# Percy
170207
python_311_percy:
171208
docker:
@@ -269,22 +306,18 @@ jobs:
269306

270307
steps:
271308
- checkout
272-
273309
- run:
274-
name: initial NPM Build
310+
name: PyPI Build
275311
command: |
276-
python -m venv venv
277-
. venv/bin/activate
312+
curl -LsSf https://astral.sh/uv/install.sh | sh
313+
uv venv
314+
source .venv/bin/activate
315+
uv pip install build
316+
uv pip install jupyter
278317
cd js
279318
npm ci
280319
npm run build
281-
git status
282-
283-
- run:
284-
name: PyPI Build
285-
command: |
286-
. venv/bin/activate
287-
pip install build
320+
cd ..
288321
python -m build --sdist --wheel -o dist
289322
cp -R dist output
290323
git status
@@ -310,7 +343,6 @@ jobs:
310343
- checkout
311344
- browser-tools/install-chrome
312345
- browser-tools/install-chromedriver
313-
314346
- run:
315347
name: Install dependencies
316348
command: |
@@ -321,16 +353,11 @@ jobs:
321353
uv venv
322354
source .venv/bin/activate
323355
uv pip install -r requirements.txt
356+
cd ..
324357
if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then
325358
uv pip uninstall plotly
326-
cd ..
327359
uv pip install -e .
328-
cd js
329-
npm ci
330-
npm run build
331-
cd ../doc
332360
fi
333-
cd ..
334361
335362
- run:
336363
name: make html
@@ -422,7 +449,7 @@ workflows:
422449
release_build:
423450
jobs:
424451
- full_build
425-
452+
426453
build:
427454
jobs:
428455
- test_core_py:
@@ -450,5 +477,10 @@ workflows:
450477
python_version: "3.9"
451478
pandas_version: "1.2.4"
452479
numpy_version: "1.26.4"
480+
- test_kaleido_v0:
481+
matrix:
482+
parameters:
483+
python_version:
484+
- "3.12"
453485
- python_311_percy
454-
- build-doc
486+
- build-doc

.github/ISSUE_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ Thanks for your interest in Plotly.py!
22

33
Before opening an issue, please search for existing and closed issues :)
44

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.
5+
**Please** accompany bug reports with a reproducible example. Please use the [latest version](https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md) of plotly.py in your report unless not applicable.
66

77
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)).

.github/pull_request_template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ below :-).
66
77
### Documentation PR
88
9-
- [ ] I've [seen the `doc/README.md` file](https://github.com/plotly/plotly.py/blob/master/doc/README.md)
9+
- [ ] I've [seen the `doc/README.md` file](https://github.com/plotly/plotly.py/blob/main/doc/README.md)
1010
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch
1111
- [ ] If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible
1212
- [ ] Every new/modified example has a descriptive title and motivating sentence or paragraph
@@ -27,7 +27,7 @@ below :-).
2727
2828
## Code PR
2929
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.
30+
- [ ] 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 `codegen` files and not generated files.
3131
- [ ] I have added tests (if submitting a new feature or correcting a bug) or
3232
modified existing tests.
3333
- [ ] For a new feature, I have added documentation examples in an existing or

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

+66
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

.github/workflows/test-release.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on:
4+
workflow_dispatch
5+
6+
jobs:
7+
build:
8+
name: Build distribution 📦
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
persist-credentials: false
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.x"
19+
20+
- name: Install Node
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: '22'
24+
25+
- name: Install npm dependencies
26+
run: |
27+
curl -LsSf https://astral.sh/uv/install.sh | sh
28+
uv venv
29+
source .venv/bin/activate
30+
uv pip install jupyter
31+
cd js
32+
npm ci --verbose
33+
npm run build --verbose
34+
35+
- name: Install pypa/build
36+
run: >-
37+
python3 -m
38+
pip install
39+
build
40+
--user
41+
- name: Build a binary wheel and a source tarball
42+
run: python3 -m build
43+
- name: Store the distribution packages
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
48+
49+
publish-to-testpypi:
50+
name: Publish Python 🐍 distribution 📦 to TestPyPI
51+
needs:
52+
- build
53+
runs-on: ubuntu-latest
54+
55+
environment:
56+
name: testpypi
57+
url: https://test.pypi.org/p/plotly
58+
59+
permissions:
60+
id-token: write # IMPORTANT: mandatory for trusted publishing
61+
62+
steps:
63+
- name: Download all the dists
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: python-package-distributions
67+
path: dist/
68+
- name: Publish distribution 📦 to TestPyPI
69+
uses: pypa/gh-action-pypi-publish@release/v1
70+
with:
71+
repository-url: https://test.pypi.org/legacy/

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ doc/python/.mapbox_token
5959
doc/.ipynb_checkpoints
6060
tags
6161
doc/check-or-enforce-order.py
62-
plotly/package_data/widgetbundle.js
6362

6463
tests/percy/*.html
6564
tests/percy/pandas2/*.html

CHANGELOG.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
# Change Log
1+
# Changelog
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [6.1.0rc0] - 2025-05-01
6+
7+
### Updated
8+
- Add support for Kaleido>=v1.0.0 for image generation, and deprecate support for Kaleido<1 and Orca [[#5062](https://github.com/plotly/plotly.py/pull/5062)]
9+
- Reduce package bundle size by 18-24% via changes to code generation [[#4978](https://github.com/plotly/plotly.py/pull/4978)]
10+
11+
### Fixed
12+
- Fix third-party widget display issues in v6 [[#5102](https://github.com/plotly/plotly.py/pull/5102)]
13+
- Add handling for case where `jupyterlab` or `notebook` is not installed [[#5104](https://github.com/plotly/plotly.py/pull/5104/files)]
14+
- Fix issue causing Plotly.js script to be embedded multiple times in Jupyter notebooks [[#5112](https://github.com/plotly/plotly.py/pull/5112)]
15+
- Re-add MIME renderer JupyterLab extension with JupyterLab 4 support to reduce file sizes for offline notebooks [[#5096](https://github.com/plotly/plotly.py/pull/5096)]
16+
- Fix issue preventing plots from rendering in HTML notebook export when using 'vscode+notebook' renderer [[#5154](https://github.com/plotly/plotly.py/pull/5154)]
17+
518
## [6.0.1] - 2025-03-14
619

720
### Updated

CONTRIBUTING.md

+13
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ and
169169
[`pip`](https://pip.pypa.io/en/stable/reference/pip_install/#install-editable)
170170
documentation on _development mode_.
171171

172+
### Updating the `js/` directory
173+
**This is only necessary if you're making changes to files in the `js/` directory.**
174+
If you make changes to any files in the `js/` directory, you must run `npm install && npm run build` from the `js/` directory to rebuild the FigureWidget and JupyterLab extension.
175+
You must then commit the build artifacts produced in `plotly/labextension`. A CI job will verify that this step has been done correctly.
176+
177+
**Notes on the contents of the `js/` directory:**
178+
The `js/` directory contains Javascript code which helps with using Plotly in Jupyter notebooks.
179+
180+
There are two kinds of Jupyter support included in the `js/` directory:
181+
1. **Mime Renderer JupyterLab extension**: This is the default renderer for Plotly `Figure()` objects in Jupyter notebooks. The Plotly mime renderer JupyterLab extension is used automatically by JupyterLab / Jupyter Notebook
182+
when it sees the mimetype `application/vnd.plotly.v1+json` in the notebook output. The mime renderer loads `plotly.js` a single time and references it each time a Plotly figure is used in the notebook. This allows us to avoid embedding `plotly.js` in the notebook output. The JupyterLab extension source code is located at `js/src/mimeExtension.ts` and the compiled extension code is located at `plotly/labextension` in the built Python package. The command `jupyter labextension build` (which is one of the steps called by `npm run build`) compiles the extension and places the build artifacts in `plotly/labextension`.
183+
2. **FigureWidget**: This is a more-interactive method for rendering Plotly charts in notebooks. FigureWidget used by creating a `FigureWidget()` object inside the notebook code (in place of a `Figure()`). It allows for communication between the Javascript frontend and Python backend, and requires the installation of an additional Python package (`anywidget`). The FigureWidget source code is located at `js/src/widget.ts`, and is included in the built Python package at `plotly/package_data/widgetbundle.js`.
184+
172185
### Configure black code formatting
173186

174187
This repo uses the [Black](https://black.readthedocs.io/en/stable/) code formatter,

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ See the [Python documentation](https://plotly.com/python/) for more examples.
5555

5656
Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is a high-level, declarative charting library. plotly.js ships with over 30 chart types, including scientific charts, 3D graphs, statistical charts, SVG maps, financial charts, and more.
5757

58-
`plotly.py` is [MIT Licensed](https://github.com/plotly/plotly.py/blob/master/LICENSE.txt). Plotly graphs can be viewed in Jupyter notebooks, standalone HTML files, or integrated into [Dash applications](https://dash.plotly.com/).
58+
`plotly.py` is [MIT Licensed](https://github.com/plotly/plotly.py/blob/main/LICENSE.txt). Plotly graphs can be viewed in Jupyter notebooks, standalone HTML files, or integrated into [Dash applications](https://dash.plotly.com/).
5959

6060
[Contact us](https://plotly.com/consulting-and-oem/) for consulting, dashboard development, application integration, and feature additions.
6161

@@ -67,9 +67,9 @@ Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is
6767
---
6868

6969
- [Online Documentation](https://plotly.com/python/)
70-
- [Contributing to plotly](https://github.com/plotly/plotly.py/blob/master/CONTRIBUTING.md)
71-
- [Changelog](https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md)
72-
- [Code of Conduct](https://github.com/plotly/plotly.py/blob/master/CODE_OF_CONDUCT.md)
70+
- [Contributing to plotly](https://github.com/plotly/plotly.py/blob/main/CONTRIBUTING.md)
71+
- [Changelog](https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md)
72+
- [Code of Conduct](https://github.com/plotly/plotly.py/blob/main/CODE_OF_CONDUCT.md)
7373
- [Community forum](https://community.plotly.com)
7474

7575
---
@@ -147,7 +147,7 @@ conda install -c plotly plotly-geo=1.0.0
147147

148148
Code and documentation copyright 2019 Plotly, Inc.
149149

150-
Code released under the [MIT license](https://github.com/plotly/plotly.py/blob/master/LICENSE.txt).
150+
Code released under the [MIT license](https://github.com/plotly/plotly.py/blob/main/LICENSE.txt).
151151

152152
Docs released under the [Creative Commons license](https://github.com/plotly/documentation/blob/source/LICENSE).
153153

0 commit comments

Comments
 (0)