Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0fc297e

Browse files
committed
Merge branch 'main' into codegen2
2 parents 97c418f + 4dded6c commit 0fc297e

33 files changed

+14362
-4827
lines changed

‎.circleci/config.yml‎

Lines changed: 10 additions & 23 deletions
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:
@@ -269,22 +266,18 @@ jobs:
269266

270267
steps:
271268
- checkout
272-
273269
- run:
274-
name: initial NPM Build
270+
name: PyPI Build
275271
command: |
276-
python -m venv venv
277-
. venv/bin/activate
272+
curl -LsSf https://astral.sh/uv/install.sh | sh
273+
uv venv
274+
source .venv/bin/activate
275+
uv pip install build
276+
uv pip install jupyter
278277
cd js
279278
npm ci
280279
npm run build
281-
git status
282-
283-
- run:
284-
name: PyPI Build
285-
command: |
286-
. venv/bin/activate
287-
pip install build
280+
cd ..
288281
python -m build --sdist --wheel -o dist
289282
cp -R dist output
290283
git status
@@ -310,7 +303,6 @@ jobs:
310303
- checkout
311304
- browser-tools/install-chrome
312305
- browser-tools/install-chromedriver
313-
314306
- run:
315307
name: Install dependencies
316308
command: |
@@ -319,16 +311,11 @@ jobs:
319311
uv venv
320312
source .venv/bin/activate
321313
uv pip install -r requirements.txt
314+
cd ..
322315
if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then
323316
uv pip uninstall plotly
324-
cd ..
325317
uv pip install -e .
326-
cd js
327-
npm ci
328-
npm run build
329-
cd ../doc
330318
fi
331-
cd ..
332319
333320
- run:
334321
name: make html
@@ -420,7 +407,7 @@ workflows:
420407
release_build:
421408
jobs:
422409
- full_build
423-
410+
424411
build:
425412
jobs:
426413
- test_core_py:
@@ -449,4 +436,4 @@ workflows:
449436
pandas_version: "1.2.4"
450437
numpy_version: "1.26.4"
451438
- python_311_percy
452-
- build-doc
439+
- build-doc

‎.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

‎.github/workflows/test-release.yml‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.x"
17+
18+
- name: Install Node
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: '22'
22+
23+
- name: Install npm dependencies
24+
run: |
25+
cd js
26+
npm ci --verbose
27+
npm run build --verbose
28+
29+
- name: Install pypa/build
30+
run: >-
31+
python3 -m
32+
pip install
33+
build
34+
--user
35+
- name: Build a binary wheel and a source tarball
36+
run: python3 -m build
37+
- name: Store the distribution packages
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: python-package-distributions
41+
path: dist/
42+
43+
publish-to-testpypi:
44+
name: Publish Python 🐍 distribution 📦 to TestPyPI
45+
needs:
46+
- build
47+
runs-on: ubuntu-latest
48+
49+
environment:
50+
name: testpypi
51+
url: https://test.pypi.org/p/plotly
52+
53+
permissions:
54+
id-token: write # IMPORTANT: mandatory for trusted publishing
55+
56+
steps:
57+
- name: Download all the dists
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: python-package-distributions
61+
path: dist/
62+
- name: Publish distribution 📦 to TestPyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
repository-url: https://test.pypi.org/legacy/

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
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‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
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+
## Unreleased
6+
7+
### Fixed
8+
- Fix third-party widget display issues in v6 [[#5102]https://github.com/plotly/plotly.py/pull/5102]
9+
510
## [6.0.1] - 2025年03月14日
611

712
### Updated

‎CONTRIBUTING.md‎

Lines changed: 13 additions & 0 deletions
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,

‎doc/python/3d-axes.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.15.1
9+
jupytext_version: 1.16.4
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -114,7 +114,7 @@ fig = make_subplots(rows=2, cols=2,
114114
print_grid=False)
115115
for i in [1,2]:
116116
for j in [1,2]:
117-
fig.append_trace(
117+
fig.add_trace(
118118
go.Mesh3d(
119119
x=(60*np.random.randn(N)),
120120
y=(25*np.random.randn(N)),

‎doc/python/histograms.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.1
9+
jupytext_version: 1.16.4
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.8
23+
version: 3.11.10
2424
plotly:
2525
description: How to make Histograms in Python with Plotly.
2626
display_as: statistical
@@ -438,12 +438,12 @@ trace5 = go.Histogram(x=x,
438438
autobinx = False
439439
)
440440

441-
fig.append_trace(trace0, 1, 1)
442-
fig.append_trace(trace1, 1, 2)
443-
fig.append_trace(trace2, 2, 1)
444-
fig.append_trace(trace3, 2, 2)
445-
fig.append_trace(trace4, 3, 1)
446-
fig.append_trace(trace5, 3, 2)
441+
fig.add_trace(trace0, 1, 1)
442+
fig.add_trace(trace1, 1, 2)
443+
fig.add_trace(trace2, 2, 1)
444+
fig.add_trace(trace3, 2, 2)
445+
fig.add_trace(trace4, 3, 1)
446+
fig.add_trace(trace5, 3, 2)
447447

448448
fig.show()
449449
```

‎doc/python/horizontal-bar-charts.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
9-
jupytext_version: 1.1.1
8+
format_version: '1.3'
9+
jupytext_version: 1.16.4
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.6.7
23+
version: 3.11.10
2424
plotly:
2525
description: How to make horizontal bar charts in Python with Plotly.
2626
display_as: basic
@@ -239,7 +239,7 @@ x = ['Japan', 'United Kingdom', 'Canada', 'Netherlands',
239239
fig = make_subplots(rows=1, cols=2, specs=[[{}, {}]], shared_xaxes=True,
240240
shared_yaxes=False, vertical_spacing=0.001)
241241

242-
fig.append_trace(go.Bar(
242+
fig.add_trace(go.Bar(
243243
x=y_saving,
244244
y=x,
245245
marker=dict(
@@ -252,7 +252,7 @@ fig.append_trace(go.Bar(
252252
orientation='h',
253253
), 1, 1)
254254

255-
fig.append_trace(go.Scatter(
255+
fig.add_trace(go.Scatter(
256256
x=y_net_worth, y=x,
257257
mode='lines+markers',
258258
line_color='rgb(128, 0, 128)',
@@ -335,4 +335,4 @@ fig.show()
335335

336336
### Reference
337337

338-
See more examples of bar charts and styling options [here](https://plotly.com/python/bar-charts/).<br> See https://plotly.com/python/reference/bar/ for more information and chart attribute options!
338+
See more examples of bar charts and styling options [here](https://plotly.com/python/bar-charts/).<br> See https://plotly.com/python/reference/bar/ for more information and chart attribute options!

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /