Skip to content

Commit ea813dd

Browse files
authored
Merge branch 'main' into fix/broken-license-link-readme
2 parents 559ad68 + 0a46b63 commit ea813dd

File tree

76 files changed

+2355
-936
lines changed

Some content is hidden

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

76 files changed

+2355
-936
lines changed

.github/pull_request_template.md

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
11
<!--
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.
5-
6-
If your PR modifies code of the `plotly` package, we have a different checklist below.
7-
8-
## Documentation PR
9-
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`.
29-
30-
## Code PR
31-
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.
2+
Thank you for your contribution to plotly.py!
373
4+
Please complete each section below.
385
-->
6+
7+
### Link to issue
8+
<!-- Link to the issue closed by this PR. If the issue doesn't exist yet, create it. -->
9+
10+
Closes #(issue number)
11+
12+
### Description of change
13+
<!-- Provide a clear 1-2 sentence description of what this PR does. -->
14+
15+
### Demo
16+
17+
<!-- Include screenshots or screen recordings of this PR in action. -->
18+
19+
### Testing strategy
20+
21+
<!-- Provide 1-2 sentences explaining tests added or changed by this PR. If testing changes are not needed, explain why. -->
22+
23+
### Additional information (optional)
24+
25+
<!-- Include any additional context, background, or explanation which doesn't fit in the previous sections. -->
26+
27+
### Guidelines
28+
29+
- [ ] I have reviewed the [pull request guidelines](https://github.com/plotly/plotly.py/blob/main/CONTRIBUTING.md#opening-a-pull-request) and the [Code of Conduct](https://github.com/plotly/plotly.py/blob/main/CODE_OF_CONDUCT.md) and confirm that this PR follows them.
30+
- [ ] I have added an entry to the [changelog](https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md) if needed (not required for documentation PRs).

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

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,60 @@ on: push
22

33
jobs:
44
check-js-build:
5-
name: Check JS build artifacts
5+
name: Check JS version number and build artifacts
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v4
99
- name: Set up Python
1010
uses: actions/setup-python@v5
1111
with:
1212
python-version: "3.x"
13-
13+
14+
- name: Check that version number for JS project matches version number for Python project
15+
run: |
16+
PYPROJECT_PATH="pyproject.toml"
17+
PKGJSON_PATH="js/package.json"
18+
PYPROJECT_VERSION=$(awk -F'"' '/^version/ {print $2; exit}' $PYPROJECT_PATH)
19+
JSPROJECT_VERSION=$(cat $PKGJSON_PATH | jq -r '.version')
20+
if [ "$PYPROJECT_VERSION" != "$JSPROJECT_VERSION" ]; then
21+
echo "❌ Version number $JSPROJECT_VERSION in $PKGJSON_PATH does not match version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
22+
exit 1
23+
else
24+
echo "✅ Version number $JSPROJECT_VERSION in $PKGJSON_PATH matches version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
25+
fi
1426
- name: Install Node
15-
uses: actions/setup-node@v2
27+
uses: actions/setup-node@v4
1628
with:
1729
node-version: '22'
1830

1931
- name: Copy current files to a temporary directory
2032
run: |
21-
cp -R plotly/labextension/ plotly/labextension-tmp/
33+
mv plotly/labextension/ plotly/labextension-tmp/
2234
2335
- name: Install dependencies and build
2436
run: |
2537
curl -LsSf https://astral.sh/uv/install.sh | sh
2638
uv venv
2739
source .venv/bin/activate
28-
uv pip install jupyter
40+
uv pip install jupyterlab
2941
cd js
3042
npm ci
3143
npm run build
3244
npm ls
3345
- name: Check JupyterLab build artifacts
3446
run: |
35-
# 1. Hash contents of all static files, sort by content hash
36-
find plotly/labextension/static -type f -exec sha256sum {} \; | awk '{print $1}' | sort > new_hashes.txt
37-
find plotly/labextension-tmp/static -type f -exec sha256sum {} \; | awk '{print $1}' | sort > old_hashes.txt
38-
39-
# 2. Compare the sorted content hashes
40-
diff old_hashes.txt new_hashes.txt > content_diff.txt
41-
42-
# Remove the "load" line from both package.json files before comparing
43-
grep -v '"load": "static/' plotly/labextension/package.json > pkg1.json
44-
grep -v '"load": "static/' plotly/labextension-tmp/package.json > pkg2.json
45-
46-
# Compare stripped versions
47-
diff pkg1.json pkg2.json > package_json_diff.txt
47+
# Compare the plotly/labextension and plotly/labextension-tmp directories
48+
diff -r --brief plotly/labextension/ plotly/labextension-tmp/ > labextension_diff.txt
4849
49-
# 5. Final check
50-
if [ -s content_diff.txt ] || [ -s package_json_diff.txt ]; then
50+
# Check for differences
51+
if [ -s labextension_diff.txt ]; then
5152
echo "❌ Build artifacts differ:"
5253
echo "--- Unexpected diffs ---"
53-
cat content_diff.txt
54-
echo "--- Unexpected package.json diffs ---"
55-
cat package_json_diff.txt
54+
cat labextension_diff.txt
5655
echo "Please replace the 'plotly/labextension' directory with the artifacts of this CI run."
5756
exit 1
5857
else
59-
echo "✅ Build artifacts match expected output (ignoring known 'load' hash in package.json)."
58+
echo "✅ Build artifacts match expected output"
6059
fi
6160
6261
- name: Store the build artifacts from plotly/labextension

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## Unreleased
66

7+
### Added
8+
- Add `facet_row` support to `px.imshow` for creating subplots along an additional dimension [[#5445](https://github.com/plotly/plotly.py/pull/5445)]
9+
10+
### Fixed
11+
- Update `numpy.percentile` syntax to stop using deprecated alias [[5483](https://github.com/plotly/plotly.py/pull/5483)], with thanks to @Mr-Neutr0n for the contribution!
12+
- `numpy` with a version less than 1.22 is no longer supported.
13+
14+
## [6.6.0] - 2026-03-02
15+
16+
### Fixed
17+
- Remove unneeded `type="text/javascript"` attribute from `<style>` tag [[#5454](https://github.com/plotly/plotly.py/pull/5454)], with thanks to @hannob for the contribution!
18+
- Remove global warning format side effect [[#5481](https://github.com/plotly/plotly.py/pull/5481)], with thanks to @emmanuel-ferdman for the contribution!
19+
- Fix spurious engine deprecation warning in write_image [[#5517](https://github.com/plotly/plotly.py/pull/5517)], with thanks to @mosh3eb for the contribution!
20+
21+
### Updated
22+
- Update plotly.js from version 3.3.1 to version 3.4.0. See the plotly.js [release notes](https://github.com/plotly/plotly.js/releases/tag/v3.4.0) for more information. [[#5527](https://github.com/plotly/plotly.py/pull/5527)]. Notable changes include:
23+
- Add support for clicking legend titles to toggle visibility of all traces in legend [[#7698](https://github.com/plotly/plotly.js/pull/7698)]
24+
- Add support for shapes to reference multiple axes [[#7666](https://github.com/plotly/plotly.js/pull/7666)]
25+
- Add support for dashed marker lines in scatter plots [[#7673](https://github.com/plotly/plotly.js/pull/7673)]
26+
- Increase axis autorange when bar charts have outside text labels, to avoid labels being clipped [[#7675](https://github.com/plotly/plotly.js/pull/7675)]
27+
728
## [6.5.2] - 2026-01-14
829

930
### Fixed
@@ -780,7 +801,7 @@ Items in this section may be considered backwards-incompatible changes for the p
780801
- if either `x` or `y` (but not both) may now be provided as a list of column references into `data_frame` or columns of data, in which case the imputed data frame will be treated as "wide" data and `melt()`ed internally before applying the usual mapping rules, with function-specific defaults.
781802
- if neither `x` nor `y` is provided but `data_frame` is, the data frame will be treated as "wide" with defaults depending on the value of `orientation` (and `orientation` has accordingly been added to `scatter`, `line`, `density_heatmap`, and `density_contour` for this purpose). Previously this would have resulted in an empty figure.
782803
- if both `x` and `y` are provided to `histogram`, and if `x`, `y` and `z` are provided to `density_heatmap` or `density_contour`, then `histfunc` now defaults to `sum` so as to avoid ignoring the provided data, and to cause `histogram` and `bar` to behave more similarly.
783-
- `violinmode`, `boxmode` and `stripmode` now default to `overlay` if `x` (`y`) in in `v` (`h`) orientation is also mapped to `color`, to avoid strange spacing issues with the previous default of `group` in all cases.
804+
- `violinmode`, `boxmode` and `stripmode` now default to `overlay` if `x` (`y`) in `v` (`h`) orientation is also mapped to `color`, to avoid strange spacing issues with the previous default of `group` in all cases.
784805
- The Plotly Express arguments `color_discrete_map`, `symbol_map` and `line_dash_map` now accept the string `"identity"` which causes the corresponding input data to be used as-is rather than mapped into `color_discrete_sequence`, `symbol_sequence` or `line_dash_sequence`, respectively. ([#2336](https://github.com/plotly/plotly.py/pull/2336))
785806
- Plotly Express now accepts `px.Constant` or `px.Range` objects in the place of column references so as to express constant or increasing integer values. ([#2336](https://github.com/plotly/plotly.py/pull/2336))
786807

CITATION.cff

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
cff-version: 1.2.0
2-
message: "If you use this software, please cite it as below."
3-
authors:
4-
- family-names: "Kruchten"
5-
given-names: "Nicolas"
6-
orcid: https://orcid.org/0000-0002-8416-789X
7-
- family-names: "Seier"
8-
given-names: "Andrew"
9-
- family-names: "Parmer"
10-
given-names: "Chris"
11-
title: "An interactive, open-source, and browser-based graphing library for Python"
12-
version: 6.5.2
13-
doi: 10.5281/zenodo.14503524
14-
date-released: 2026-01-14
15-
url: "https://github.com/plotly/plotly.py"
1+
cff-version: 1.2.0
2+
message: "If you use this software, please cite it as below."
3+
authors:
4+
- family-names: "Kruchten"
5+
given-names: "Nicolas"
6+
orcid: https://orcid.org/0000-0002-8416-789X
7+
- family-names: "Seier"
8+
given-names: "Andrew"
9+
- family-names: "Parmer"
10+
given-names: "Chris"
11+
title: "An interactive, open-source, and browser-based graphing library for Python"
12+
version: 6.6.0
13+
doi: 10.5281/zenodo.14503524
14+
date-released: 2026-03-02
15+
url: "https://github.com/plotly/plotly.py"

CONTRIBUTING.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,42 @@ and create your pull request.
171171
> Please do _not_ commit changes to `uv.lock`
172172
> unless you have added, removed, or changed dependencies in `pyproject.toml`.
173173
174+
## Opening a pull request
175+
176+
When creating your pull request, please follow the guidelines below.
177+
178+
### Code pull request
179+
180+
- *Make sure you have reviewed the full [contributing notes (this file)](https://github.com/plotly/plotly.py/blob/main/CONTRIBUTING.md) and understand the structure of the package.*
181+
- If your PR modifies code of `plotly.graph_objects`, the modifications should be made to the code generator, *not* the generated files.
182+
- You have added tests or modified existing tests, as needed.
183+
- For a new feature, you have added documentation examples (please see the doc checklist as well).
184+
- You have added a CHANGELOG entry if changing anything substantial.
185+
- For a new feature or a change in behavior, you have updated the relevant docstrings in the code.
186+
187+
### Documentation pull request
188+
189+
- *Make sure you have reviewed the [`doc/README.md`](https://github.com/plotly/plotly.py/blob/main/doc/README.md) file.*
190+
- This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch.
191+
- If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible.
192+
- Every new/modified example has a descriptive title and motivating sentence or paragraph.
193+
- Every new/modified example is independently runnable.
194+
- 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.
195+
- Meaningful/relatable datasets are used for all new examples instead of randomly-generated data where possible.
196+
- The random seed is set if using randomly-generated data.
197+
- New/modified remote datasets are loaded from https://plotly.github.io/datasets and added to https://github.com/plotly/datasets.
198+
- Large computations are avoided in the new/modified examples in favour of loading remote datasets that represent the output of such computations.
199+
- Imports are `plotly.graph_objects as go`, `plotly.express as px`, and/or `plotly.io as pio`.
200+
- Data frames are always called `df`.
201+
- `fig = <something>` is called high up in each new/modified example (either `px.<something>` or `make_subplots` or `go.Figure`).
202+
- Liberal use is made of `fig.add_*` and `fig.update_*` rather than `go.Figure(data=..., layout=...)`.
203+
- Specific adders and updaters like `fig.add_shape` and `fig.update_xaxes` are used instead of big `fig.update_layout` calls.
204+
- `fig.show()` is at the end of each example.
205+
- `plotly.plot()` and `plotly.iplot()` are not used in any example.
206+
- Named colors are used instead of hex codes wherever possible.
207+
- Code blocks are marked with `&#96;&#96;&#96;python`.
208+
209+
174210
### Testing
175211

176212
We use [pytest](https://docs.pytest.org/) for managing and running tests.
@@ -271,3 +307,18 @@ You can then run the following command
271307
```bash
272308
python commands.py updateplotlyjsdev --local /path/to/your/plotly.js/
273309
```
310+
311+
## Documentation for `commands.py`
312+
313+
`commands.py` serves as an entry point for utilities to help with plotly.py development.
314+
315+
Usage: `python commands.py <subcommand> <args>`
316+
317+
| Subcommand | Purpose |
318+
|------------|---------|
319+
| `codegen [--noformat]` | Regenerate Python files according to `plot-schema.json`.`--noformat` skips formatter step. |
320+
| `lint` | Lint all Python code in `plotly/`. |
321+
| `format` | Format all Python code in `plotly/`. |
322+
| `updateplotlyjs` | Update `plotly.min.js` and `plot-schema.json` to match the `plotly.js` version specified in `js/package.json`. Then, run codegen to regenerate the Python files. |
323+
| `updateplotlyjsdev [--devrepo REPONAME --devbranch BRANCHNAME] \| [--local PATH]` | Update `plot-schema.json` and `plotly.min.js` to match the version in the provided plotly.js repo name and branch name, OR local path. Then, run codegen to regenerate the Python files. |
324+
| `bumpversion X.Y.Z` | Update the plotly.py version number to X.Y.Z across all files where it needs to be updated. |

MANIFEST.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

RELEASE.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ This is the release process for releasing plotly.py version `X.Y.Z`, including c
77

88
### Finalize changelog
99

10-
Review the contents of `CHANGELOG.md`. We try to follow
10+
Review the contents of `CHANGELOG.md` under the **Unreleased** header. We try to follow
1111
the [keepachangelog](https://keepachangelog.com/en/1.0.0/) guidelines.
12-
Make sure the changelog includes the version being published at the top, along
13-
with the expected publication date.
12+
13+
**Note: You don't need to update the header itself with the new version number,
14+
as that will be done automatically as part of the next step.**
1415

1516
Use the `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, and `Security`
1617
labels for all changes to plotly.py. If the version of plotly.js has
@@ -22,16 +23,24 @@ a link to the plotly.js CHANGELOG.
2223

2324
**Create a release branch `git checkout -b release-X.Y.Z` _from the tip of `origin/main`_.**
2425

25-
- Manually update the versions to `X.Y.Z` in the files specified below:
26+
- Ensure that you have `npm` and `uv` installed in your environment
27+
28+
- Run the command `python commands.py bumpversion X.Y.Z`, which will update the version to X.Y.Z in the following places
2629
- `pyproject.toml`
27-
- update version
28-
- `CHANGELOG.md`
29-
- update version and release date
30-
- finalize changelog entries according to instructions above
30+
- `uv.lock`
31+
- `js/package.json`
32+
- `js/package-lock.json`
33+
- `CHANGELOG.md` (Adds a new header for X.Y.Z above the unreleased items)
3134
- `CITATION.cff`
32-
- update version and release date
33-
- Run `uv lock` to update the version number in the `uv.lock` file (do not update manually)
34-
- Commit and push your changes to the release branch:
35+
36+
- Run `git diff` and ensure the above files were all updated correctly.
37+
- Note: The current date is used as the release date in `CHANGELOG.md` and `CITATION.cff`. If you want to use a different date, edit these files manually afterward.
38+
- If the bumpversion command failed for any reason, you can update the versions yourself by doing the following:
39+
- Manually update the version number (and release date, as needed) in `pyproject.toml`, `CHANGELOG.md` and `CITATION.cff`
40+
- Run `npm version X.Y.Z` to update `js/package.json` and `js/package-lock.json`
41+
- Run `uv lock` to update `uv.lock`
42+
43+
- Commit and push the changed files to the release branch:
3544
```sh
3645
$ git add -u
3746
$ git commit -m "version changes for vX.Y.Z"

_plotly_utils/basevalidators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ def __init__(
878878

879879
def description(self):
880880
desc = """\
881-
The '{plotly_name}' property is a integer and may be specified as:""".format(
881+
The '{plotly_name}' property is an integer and may be specified as:""".format(
882882
plotly_name=self.plotly_name
883883
)
884884

0 commit comments

Comments
 (0)