Skip to content

Commit 4ffb5da

Browse files
authored
Merge branch 'main' into release-testpypi-main
2 parents aba1f3d + 799eb10 commit 4ffb5da

39 files changed

+475
-547
lines changed

.circleci/config.yml

+128-209
Large diffs are not rendered by default.

CHANGELOG.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
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.0.1] - 2025-02-16
5+
## Unreleased
66

77
### Fixed
8-
- Fix `TypeError` when using `orjson` to serialize `pandas.NA`.
8+
- Fix third-party widget display issues in v6 [[#5102]https://github.com/plotly/plotly.py/pull/5102]
9+
10+
## [6.0.1] - 2025-03-14
11+
12+
### Updated
13+
- Updated Plotly.js from version 3.0.0 to version 3.0.1. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#301----2025-02-18) for more information.
14+
15+
16+
### Fixed
17+
- Fix `TypeError` when using `orjson` to serialize `pandas.NA` [[#5040](https://github.com/plotly/plotly.py/pull/5040)].
18+
- Fix issue where using `category_orders` on `px.pie` raised `ColumnNotFoundError` [[#5000](https://github.com/plotly/plotly.py/pull/5000)].
19+
- Fix incorrect `DeprecationWarning` shown when creating a `px` chart [[#5080](https://github.com/plotly/plotly.py/pull/5080), [#5086](https://github.com/plotly/plotly.py/pull/5086)]
20+
921

1022
## [6.0.0] - 2025-01-28
1123

RELEASE.md

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ Publishing to PyPI:
7070
### Update documentation site
7171

7272
1. Search for the previous version string in the docs and replace it with the new version string, including but not necessarily limited to the following files:
73-
- `doc/python/getting-started.md`
7473
- `doc/apidoc/conf.py`
7574
- `doc/requirements.txt`
7675
2. `doc-prod` should already have been merged on a regular basis into `main`, but

codegen/datatypes.py

+23-5
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ def build_datatype_py(node):
102102
)
103103
buffer.write(f"import copy as _copy\n")
104104

105-
if node.name_property in deprecated_mapbox_traces:
106-
buffer.write(f"from warnings import warn\n")
105+
if (
106+
node.name_property in deprecated_mapbox_traces
107+
or node.name_property == "template"
108+
):
109+
buffer.write(f"import warnings\n")
107110

108111
# Write class definition
109112
# ----------------------
@@ -375,9 +378,24 @@ def __init__(self"""
375378
f"""
376379
_v = arg.pop('{name_prop}', None)
377380
_v = {name_prop} if {name_prop} is not None else _v
378-
if _v is not None:
379-
self['{name_prop}'] = _v"""
381+
if _v is not None:"""
380382
)
383+
if datatype_class == "Template" and name_prop == "data":
384+
buffer.write(
385+
"""
386+
# Template.data contains a 'scattermapbox' key, which causes a
387+
# go.Scattermapbox trace object to be created during validation.
388+
# In order to prevent false deprecation warnings from surfacing,
389+
# we suppress deprecation warnings for this line only.
390+
with warnings.catch_warnings():
391+
warnings.filterwarnings("ignore", category=DeprecationWarning)
392+
self["data"] = _v"""
393+
)
394+
else:
395+
buffer.write(
396+
f"""
397+
self['{name_prop}'] = _v"""
398+
)
381399

382400
# ### Literals ###
383401
if literal_nodes:
@@ -413,7 +431,7 @@ def __init__(self"""
413431
if node.name_property in deprecated_mapbox_traces:
414432
buffer.write(
415433
f"""
416-
warn(
434+
warnings.warn(
417435
"*{node.name_property}* is deprecated!"
418436
+ " Use *{node.name_property.replace("mapbox", "map")}* instead."
419437
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",

doc/apidoc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = ""
2828
# The full version, including alpha/beta/rc tags
29-
release = "6.0.0"
29+
release = "6.0.1"
3030

3131

3232
# -- General configuration ---------------------------------------------------

doc/python/ml-pca.md

-12
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,6 @@ fig.update_traces(diagonal_visible=False)
136136
fig.show()
137137
```
138138

139-
## PCA analysis in Dash
140-
141-
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
142-
143-
Get started with [the official Dash docs](https://dash.plotly.com/installation) and **learn how to effortlessly [style](https://plotly.com/dash/design-kit/) & [deploy](https://plotly.com/dash/app-manager/) apps like this with <a class="plotly-red" href="https://plotly.com/dash/">Dash Enterprise</a>.**
144-
145-
146-
```python hide_code=true
147-
from IPython.display import IFrame
148-
snippet_url = 'https://python-docs-dash-snippets.herokuapp.com/python-docs-dash-snippets/'
149-
IFrame(snippet_url + 'pca-visualization', width='100%', height=1200)
150-
```
151139

152140
<div style="font-size: 0.9em;"><div style="width: calc(100% - 30px); box-shadow: none; border: thin solid rgb(229, 229, 229);"><div style="padding: 5px;"><div><p><strong>Sign up for Dash Club</strong> → Free cheat sheets plus updates from Chris Parmer and Adam Schroeder delivered to your inbox every two months. Includes tips and tricks, community apps, and deep dives into the Dash architecture.
153141
<u><a href="https://go.plotly.com/dash-club?utm_source=Dash+Club+2022&utm_medium=graphing_libraries&utm_content=inline">Join now</a></u>.</p></div></div></div></div>

doc/python/text-and-annotations.md

+60
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,66 @@ fig.add_annotation(
782782

783783
fig.show()
784784
```
785+
### Specifying Source Lines or Figure Notes on the Bottom of a Figure
786+
787+
This example shows how to add a note about the data source or interpretation at the bottom of the figure. This example aligns the note in the bottom right corner using the title element and container coordinates and then uses an annotation to add a figure title. A near zero container coordinate is an easy and robust way to put text -- such as a source line or figure note -- at the bottom of a figure. It is easier to specify the bottom of the figure in container coordinates than using paper coordinates, since uncertainty about the size of legends and x-axis labels make the paper coordinate of the bottom of the figure uncertain. Making the y container coordinate very slightly positive avoids cutting off the descending strokes of letters like y, p, and q. Only the title command supports container coordinates, so this example re-purposes the title element to insert the note and re-purposes an annotation element for the title. The top of the figure is typically less cluttered and more predictable than the bottom of the figure, so an annotation with its bottom at a paper y-coordinate slightly greater than 1 is a reasonable title location on many graphs.
788+
789+
```python
790+
import plotly.express as px
791+
df = px.data.iris()
792+
fig.update_layout(
793+
title=dict(text="Note: this is the Plotly title element.",
794+
# keeping this title string short avoids getting the text cut off in small windows
795+
# if you need longer text, consider 1) embedding your graphic on a web page and
796+
# putting the note in the HTML to use the browser's automated word wrap,
797+
# 2) using this approach and also specifying a graph width that shows the whole title,
798+
# or 3) using <BR> tags to wrap the text onto multiple lines
799+
yref="container",
800+
y=0.005,
801+
# The "paper" x-coordinates lets us align this with either the right or left
802+
# edge of the plot region.
803+
# The code to align this flush with the right edge of the plot area is
804+
# predictable and simple.
805+
# Putting the title in the lower left corner, aligned with the left edge of the axis labeling would
806+
# require graph specific coordinate adjustments.
807+
xref="paper",
808+
xanchor="right",
809+
x=1,
810+
font=dict(size=12)),
811+
plot_bgcolor="white",
812+
813+
# We move the legend out of the right margin so the right-aligned note is
814+
# flush with the right most element of the graph.
815+
# Here we put the legend in a corner of the graph region
816+
# because it has consistent coordinates at all screen resolutions.
817+
legend=dict(
818+
yanchor="top",
819+
y=1,
820+
xanchor="right",
821+
x=1,
822+
borderwidth=1)
823+
)
824+
825+
# Insert a title by repurposing an annotation
826+
fig.add_annotation(
827+
yref="paper",
828+
yanchor="bottom",
829+
y=1.025, # y = 1 is the top of the plot area; the top is typically uncluttered, so placing
830+
# the bottom of the title slightly above the graph region works on a wide variety of graphs
831+
text="This title is a Plotly annotation",
832+
833+
# Center the title horizontally over the plot area
834+
xref="paper",
835+
xanchor="center",
836+
x=0.5,
837+
838+
showarrow=False,
839+
font=dict(size=18)
840+
)
841+
842+
fig.show()
843+
```
844+
785845

786846
### Customize Displayed Text with a Text Template
787847

doc/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plotly==6.0.0
1+
plotly==6.0.1
22
jupytext==1.16.4
33
jupyter-client<7
44
jupyter

js/package-lock.json

+19-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"dependencies": {
88
"lodash-es": "^4.17.21",
9-
"plotly.js": "3.0.0"
9+
"plotly.js": "3.0.1"
1010
},
1111
"devDependencies": {
1212
"@types/plotly.js": "^2.33.4",

plotly/basewidget.py

+5
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ def __init__(
142142
# views of this widget
143143
self._view_count = 0
144144

145+
# Initialize widget layout and data for third-party widget integration
146+
# --------------------------------------------------------------------
147+
self._widget_layout = deepcopy(self._layout_obj._props)
148+
self._widget_data = deepcopy(self._data)
149+
145150
def show(self, *args, **kwargs):
146151
return self
147152

plotly/graph_objs/_choroplethmapbox.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
22
import copy as _copy
3-
from warnings import warn
3+
import warnings
44

55

66
class Choroplethmapbox(_BaseTraceType):
@@ -2380,7 +2380,7 @@ def __init__(
23802380
# ------------------
23812381
self._skip_invalid = False
23822382

2383-
warn(
2383+
warnings.warn(
23842384
"*choroplethmapbox* is deprecated!"
23852385
+ " Use *choroplethmap* instead."
23862386
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",

plotly/graph_objs/_densitymapbox.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
22
import copy as _copy
3-
from warnings import warn
3+
import warnings
44

55

66
class Densitymapbox(_BaseTraceType):
@@ -2321,7 +2321,7 @@ def __init__(
23212321
# ------------------
23222322
self._skip_invalid = False
23232323

2324-
warn(
2324+
warnings.warn(
23252325
"*densitymapbox* is deprecated!"
23262326
+ " Use *densitymap* instead."
23272327
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",

plotly/graph_objs/_scattermapbox.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
22
import copy as _copy
3-
from warnings import warn
3+
import warnings
44

55

66
class Scattermapbox(_BaseTraceType):
@@ -2294,7 +2294,7 @@ def __init__(
22942294
# ------------------
22952295
self._skip_invalid = False
22962296

2297-
warn(
2297+
warnings.warn(
22982298
"*scattermapbox* is deprecated!"
22992299
+ " Use *scattermap* instead."
23002300
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",

plotly/graph_objs/layout/_template.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
22
import copy as _copy
3+
import warnings
34

45

56
class Template(_BaseLayoutHierarchyType):
@@ -324,7 +325,13 @@ def __init__(self, arg=None, data=None, layout=None, **kwargs):
324325
_v = arg.pop("data", None)
325326
_v = data if data is not None else _v
326327
if _v is not None:
327-
self["data"] = _v
328+
# Template.data contains a 'scattermapbox' key, which causes a
329+
# go.Scattermapbox trace object to be created during validation.
330+
# In order to prevent false deprecation warnings from surfacing,
331+
# we suppress deprecation warnings for this line only.
332+
with warnings.catch_warnings():
333+
warnings.filterwarnings("ignore", category=DeprecationWarning)
334+
self["data"] = _v
328335
_v = arg.pop("layout", None)
329336
_v = layout if layout is not None else _v
330337
if _v is not None:

plotly/io/_renderers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ def display_jupyter_version_warnings():
5050
return
5151
elif "jupyter-notebook" in parent_process:
5252
jupyter_notebook = optional_imports.get_module("notebook")
53-
if jupyter_notebook.__version__ < "7":
53+
if jupyter_notebook is not None and jupyter_notebook.__version__ < "7":
5454
# Add warning about upgrading notebook
5555
warnings.warn(
5656
f"Plotly version >= 6 requires Jupyter Notebook >= 7 but you have {jupyter_notebook.__version__} installed.\n To upgrade Jupyter Notebook, please run `pip install notebook --upgrade`."
5757
)
5858
elif "jupyter-lab" in parent_process:
5959
jupyter_lab = optional_imports.get_module("jupyterlab")
60-
if jupyter_lab.__version__ < "3":
60+
if jupyter_lab is not None and jupyter_lab.__version__ < "3":
6161
# Add warning about upgrading jupyterlab
6262
warnings.warn(
6363
f"Plotly version >= 6 requires JupyterLab >= 3 but you have {jupyter_lab.__version__} installed. To upgrade JupyterLab, please run `pip install jupyterlab --upgrade`."

plotly/offline/_plotlyjs_version.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# DO NOT EDIT
2-
# This file is generated by the updatebundle setup.py command
3-
__plotlyjs_version__ = "3.0.0"
2+
# This file is generated by the updatebundle commands.py command
3+
__plotlyjs_version__ = "3.0.1"

plotly/package_data/plotly.min.js

+77-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plotly/tools.py

-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ def warning_on_one_line(message, category, filename, lineno, file=None, line=Non
6161

6262
warnings.formatwarning = warning_on_one_line
6363

64-
ipython_core_display = optional_imports.get_module("IPython.core.display")
65-
sage_salvus = optional_imports.get_module("sage_salvus")
66-
6764

6865
### mpl-related tools ###
6966
def mpl_to_plotly(fig, resize=False, strip_style=False, verbose=False):

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ classifiers = [
3232
"Programming Language :: Python :: 3.10",
3333
"Programming Language :: Python :: 3.11",
3434
"Programming Language :: Python :: 3.12",
35+
"Programming Language :: Python :: 3.13",
3536
"Topic :: Scientific/Engineering :: Visualization",
3637
"License :: OSI Approved :: MIT License"
3738
]
3839
requires-python = ">=3.8"
3940
license = {file="LICENSE.txt"}
40-
version = "6.0.0"
41+
version = "6.0.1"
4142
dependencies = [
4243
"narwhals>=1.15.1",
4344
"packaging"

test_requirements/requirements_310_core.txt

-3
This file was deleted.

0 commit comments

Comments
 (0)