Skip to content

Commit 249cc9f

Browse files
committed
deprecation warning wording
1 parent 8b47a0a commit 249cc9f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

plotly/io/_kaleido.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import plotly
99
from plotly.io._utils import validate_coerce_fig_to_dict
1010

11+
ENGINE_SUPPORT_TIMELINE = "September 2025"
12+
1113
try:
1214
import kaleido
1315

@@ -95,7 +97,7 @@ def to_image(
9597
# -------------
9698
if engine is not None:
9799
warnings.warn(
98-
"The 'engine' parameter is deprecated and will be removed in a future version.",
100+
f"DeprecationWarning: The 'engine' argument is deprecated. Kaleido will be the only supported engine after {ENGINE_SUPPORT_TIMELINE}.",
99101
DeprecationWarning,
100102
)
101103
engine = "auto"
@@ -118,8 +120,8 @@ def to_image(
118120

119121
if engine == "orca":
120122
warnings.warn(
121-
"Support for the 'orca' engine is deprecated and will be removed in a future version. "
122-
"Please use the 'kaleido' engine instead.",
123+
f"Support for the orca engine is deprecated and will be removed after {ENGINE_SUPPORT_TIMELINE}. "
124+
+ "Please install Kaleido (`pip install kaleido`) to use the Kaleido engine.",
123125
DeprecationWarning,
124126
)
125127
# Fall back to legacy orca image export path
@@ -178,8 +180,7 @@ def to_image(
178180
else:
179181
# Kaleido v0
180182
warnings.warn(
181-
"Support for kaleido v0 is deprecated and will be removed in a future version. "
182-
"Please upgrade to kaleido v1 by running `pip install kaleido>=1.0.0`.",
183+
f"Support for Kaleido versions less than 1.0.0 is deprecated and will be removed after {ENGINE_SUPPORT_TIMELINE}. Please upgrade Kaleido to version 1.0.0 or greater (`pip install --upgrade kaleido`).",
183184
DeprecationWarning,
184185
)
185186
img_bytes = scope.transform(
@@ -288,7 +289,9 @@ def write_image(
288289
289290
>>> import plotly.io as pio
290291
>>> pio.write_image(fig, file_path, format='png')
291-
""".format(file=file)
292+
""".format(
293+
file=file
294+
)
292295
)
293296

294297
# Request image
@@ -317,7 +320,9 @@ def write_image(
317320
raise ValueError(
318321
"""
319322
The 'file' argument '{file}' is not a string, pathlib.Path object, or file descriptor.
320-
""".format(file=file)
323+
""".format(
324+
file=file
325+
)
321326
)
322327
else:
323328
# We previously succeeded in interpreting `file` as a pathlib object.
@@ -380,8 +385,7 @@ def full_figure_for_development(fig, warn=True, as_dict=False):
380385
else:
381386
# Kaleido v0
382387
warnings.warn(
383-
"Support for kaleido v0 is deprecated and will be removed in a future version. "
384-
"Please upgrade to kaleido v1 by running `pip install kaleido>=1.0.0`.",
388+
f"Support for Kaleido versions less than 1.0.0 is deprecated and will be removed after {ENGINE_SUPPORT_TIMELINE}. Please upgrade Kaleido to version 1.0.0 or greater (`pip install --upgrade kaleido`).",
385389
DeprecationWarning,
386390
)
387391
fig = json.loads(scope.transform(fig, format="json").decode("utf-8"))

0 commit comments

Comments
 (0)