Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: plotly/plotly.py
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: doc-prod
Choose a base ref
...
head repository: plotly/plotly.py
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing 14,878 changed files with 137,182 additions and 313,904 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
80 changes: 56 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -58,9 +58,6 @@ commands:
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:
@@ -117,6 +114,35 @@ commands:
source .venv/bin/activate
python -m pytest -x test_init/test_lazy_imports.py
test_io_kaleido_v0:
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 v0 instead of the v1 specified in requirements_optional.txt
uv pip uninstall kaleido
uv pip install kaleido==0.2.1
- run:
name: List installed packages and python version
command: |
source .venv/bin/activate
uv pip list
python --version
- run:
name: Test plotly.io image output with Kaleido v0
command: |
source .venv/bin/activate
python -m pytest tests/test_optional/test_kaleido
no_output_timeout: 20m

jobs:
check-code-formatting:
docker:
@@ -129,7 +155,7 @@ jobs:
command: |
python -m venv venv
. venv/bin/activate
pip install black==22.3.0
pip install black==25.1.0
- run:
name: Check formatting with black
command: |
@@ -166,6 +192,17 @@ jobs:
pandas_version: <<parameters.pandas_version>>
numpy_version: <<parameters.numpy_version>>

test_kaleido_v0:
parameters:
python_version:
default: "3.12"
type: string
executor:
name: docker-container
python_version: <<parameters.python_version>>
steps:
- test_io_kaleido_v0

# Percy
python_311_percy:
docker:
@@ -269,22 +306,18 @@ jobs:

steps:
- checkout

- run:
name: initial NPM Build
name: PyPI Build
command: |
python -m venv venv
. venv/bin/activate
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install build
uv pip install jupyter
cd js
npm ci
npm run build
git status
- run:
name: PyPI Build
command: |
. venv/bin/activate
pip install build
cd ..
python -m build --sdist --wheel -o dist
cp -R dist output
git status
@@ -310,7 +343,6 @@ jobs:
- checkout
- browser-tools/install-chrome
- browser-tools/install-chromedriver

- run:
name: Install dependencies
command: |
@@ -321,16 +353,11 @@ jobs:
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
cd ..
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
@@ -422,7 +449,7 @@ workflows:
release_build:
jobs:
- full_build

build:
jobs:
- test_core_py:
@@ -450,5 +477,10 @@ workflows:
python_version: "3.9"
pandas_version: "1.2.4"
numpy_version: "1.26.4"
- test_kaleido_v0:
matrix:
parameters:
python_version:
- "3.12"
- python_311_percy
- build-doc
- build-doc
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@ Thanks for your interest in Plotly.py!

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

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

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)).
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ below :-).
### Documentation PR
- [ ] I've [seen the `doc/README.md` file](https://github.com/plotly/plotly.py/blob/master/doc/README.md)
- [ ] I've [seen the `doc/README.md` file](https://github.com/plotly/plotly.py/blob/main/doc/README.md)
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch
- [ ] If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible
- [ ] Every new/modified example has a descriptive title and motivating sentence or paragraph
@@ -27,7 +27,7 @@ below :-).
## Code PR
- [ ] 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.
- [ ] 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.
- [ ] I have added tests (if submitting a new feature or correcting a bug) or
modified existing tests.
- [ ] For a new feature, I have added documentation examples in an existing or
66 changes: 66 additions & 0 deletions .github/workflows/check-js-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
on: push

jobs:
check-js-build:
name: Check JS build artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '22'

- name: Copy current files to a temporary directory
run: |
cp -R plotly/labextension/ plotly/labextension-tmp/
- name: Install dependencies and build
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install jupyter
cd js
npm ci
npm run build
- name: Check JupyterLab build artifacts
run: |
# 1. Hash contents of all static files, sort by content hash
find plotly/labextension/static -type f -exec sha256sum {} \; | awk '{print $1}' | sort > new_hashes.txt
find plotly/labextension-tmp/static -type f -exec sha256sum {} \; | awk '{print $1}' | sort > old_hashes.txt
# 2. Compare the sorted content hashes
diff old_hashes.txt new_hashes.txt > content_diff.txt
# Remove the "load" line from both package.json files before comparing
grep -v '"load": "static/' plotly/labextension/package.json > pkg1.json
grep -v '"load": "static/' plotly/labextension-tmp/package.json > pkg2.json
# Compare stripped versions
diff pkg1.json pkg2.json > package_json_diff.txt
# 5. Final check
if [ -s content_diff.txt ] || [ -s package_json_diff.txt ]; then
echo "❌ Build artifacts differ:"
echo "--- Unexpected diffs ---"
cat content_diff.txt
echo "--- Unexpected package.json diffs ---"
cat package_json_diff.txt
echo "Please replace the 'plotly/labextension' directory with the artifacts of this CI run."
exit 1
else
echo "✅ Build artifacts match expected output (ignoring known 'load' hash in package.json)."
fi
- name: Store the build artifacts from plotly/labextension
uses: actions/upload-artifact@v4
if: failure()
with:
name: labextension
path: plotly/labextension
71 changes: 71 additions & 0 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on:
workflow_dispatch

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '22'

- name: Install npm dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install jupyter
cd js
npm ci --verbose
npm run build --verbose
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/plotly

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ doc/python/.mapbox_token
doc/.ipynb_checkpoints
tags
doc/check-or-enforce-order.py
plotly/package_data/widgetbundle.js

tests/percy/*.html
tests/percy/pandas2/*.html
test_path.png
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
# Change Log
# Changelog
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [6.1.2] - 2025-05-27

### Fixed
- Fix type checking and code highlighting for `graph_objects` classes [[#5199](https://github.com/plotly/plotly.py/pull/5199)]


## [6.1.1] - 2025-05-20

### Fixed
- Prevent swallowing of `ValueError` when creating a figure with subplots [[#3888](https://github.com/plotly/plotly.py/pull/3888)]
- Fix issue causing `fig.write_image()` to not generate an image [[#5193](https://github.com/plotly/plotly.py/pull/5193)]

## [6.1.0] - 2025-05-15

### Updated
- Add support for Kaleido>=v1.0.0 for image generation [[#5062](https://github.com/plotly/plotly.py/pull/5062), [#5177](https://github.com/plotly/plotly.py/pull/5177)]
- Reduce package bundle size by 18-24% via changes to code generation [[#4978](https://github.com/plotly/plotly.py/pull/4978)]

### Fixed
- Fix third-party widget display issues in v6 [[#5102](https://github.com/plotly/plotly.py/pull/5102)]
- Add handling for case where `jupyterlab` or `notebook` is not installed [[#5104](https://github.com/plotly/plotly.py/pull/5104/files)]
- Fix issue causing Plotly.js script to be embedded multiple times in Jupyter notebooks [[#5112](https://github.com/plotly/plotly.py/pull/5112)]
- 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)]
- Fix issue preventing plots from rendering in HTML notebook export when using 'vscode+notebook' renderer [[#5154](https://github.com/plotly/plotly.py/pull/5154)]

## [6.0.1] - 2025-03-14

### Updated
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -169,6 +169,19 @@ and
[`pip`](https://pip.pypa.io/en/stable/reference/pip_install/#install-editable)
documentation on _development mode_.

### Updating the `js/` directory
**This is only necessary if you're making changes to files in the `js/` directory.**
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.
You must then commit the build artifacts produced in `plotly/labextension`. A CI job will verify that this step has been done correctly.

**Notes on the contents of the `js/` directory:**
The `js/` directory contains Javascript code which helps with using Plotly in Jupyter notebooks.

There are two kinds of Jupyter support included in the `js/` directory:
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
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`.
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`.

### Configure black code formatting

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