Skip to content

Commit bd54170

Browse files
committed
remove code for kaleido v0 and orca (including engine argument for image writing functions)
1 parent 49f3825 commit bd54170

9 files changed

Lines changed: 205 additions & 2286 deletions

File tree

plotly/basedatatypes.py

Lines changed: 62 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -3717,86 +3717,46 @@ def to_image(self, *args, **kwargs):
37173717
37183718
Parameters
37193719
----------
3720-
format: str or None
3721-
The desired image format. One of
3722-
- 'png'
3723-
- 'jpg' or 'jpeg'
3724-
- 'webp'
3725-
- 'svg'
3726-
- 'pdf'
3727-
- 'eps' (deprecated) (Requires the poppler library to be installed)
3728-
3729-
If not specified, will default to:
3730-
- `plotly.io.defaults.default_format` if engine is "kaleido"
3731-
- `plotly.io.orca.config.default_format` if engine is "orca" (deprecated)
3732-
3733-
width: int or None
3734-
The width of the exported image in layout pixels. If the `scale`
3735-
property is 1.0, this will also be the width of the exported image
3736-
in physical pixels.
3737-
3738-
If not specified, will default to:
3739-
- `plotly.io.defaults.default_width` if engine is "kaleido"
3740-
- `plotly.io.orca.config.default_width` if engine is "orca" (deprecated)
3741-
3742-
height: int or None
3743-
The height of the exported image in layout pixels. If the `scale`
3744-
property is 1.0, this will also be the height of the exported image
3745-
in physical pixels.
3746-
3747-
If not specified, will default to:
3748-
- `plotly.io.defaults.default_height` if engine is "kaleido"
3749-
- `plotly.io.orca.config.default_height` if engine is "orca" (deprecated)
3750-
3751-
scale: int or float or None
3752-
The scale factor to use when exporting the figure. A scale factor
3753-
larger than 1.0 will increase the image resolution with respect
3754-
to the figure's layout pixel dimensions. Whereas as scale factor of
3755-
less than 1.0 will decrease the image resolution.
3756-
3757-
If not specified, will default to:
3758-
- `plotly.io.defaults.default_scale` if engine is "kaliedo"
3759-
- `plotly.io.orca.config.default_scale` if engine is "orca" (deprecated)
3720+
fig:
3721+
Figure object or dict representing a figure
37603722
3761-
validate: bool
3762-
True if the figure should be validated before being converted to
3763-
an image, False otherwise.
3723+
format: str
3724+
(optional) The desired image format. One of:
3725+
- 'png'
3726+
- 'jpg' or 'jpeg'
3727+
- 'webp'
3728+
- 'svg'
3729+
- 'pdf'
3730+
Defaults to `plotly.io.defaults.default_format`.
3731+
3732+
width: int
3733+
(optional) The width of the exported image in layout pixels. If the
3734+
`scale` property is 1.0, this will also be the width of the exported image
3735+
in physical pixels. Defaults to `plotly.io.defaults.default_width`.
3736+
3737+
height: int
3738+
(optional) The height of the exported image in layout pixels. If the
3739+
`scale` property is 1.0, this will also be the height of the exported image
3740+
in physical pixels. Defaults to `plotly.io.defaults.default_height`.
3741+
3742+
scale: int or float
3743+
(optional) The scale factor to use when exporting the figure. A scale
3744+
factor larger than 1.0 will increase the image resolution with respect
3745+
to the figure's layout pixel dimensions, while a scale factor of
3746+
less than 1.0 will decrease the image resolution. Defaults to
3747+
`plotly.io.defaults.default_scale`.
37643748
3765-
engine (deprecated): str
3766-
Image export engine to use. This parameter is deprecated and Orca engine support will be
3767-
dropped in the next major Plotly version. Until then, the following values are supported:
3768-
- "kaleido": Use Kaleido for image export
3769-
- "orca": Use Orca for image export
3770-
- "auto" (default): Use Kaleido if installed, otherwise use Orca
3749+
validate: bool
3750+
(optional) True if the figure should be validated before being converted
3751+
to an image, False otherwise. Defaults to True.
37713752
37723753
Returns
37733754
-------
37743755
bytes
37753756
The image data
37763757
"""
3777-
import plotly.io as pio
3778-
from plotly.io.kaleido import (
3779-
kaleido_available,
3780-
kaleido_major,
3781-
ENABLE_KALEIDO_V0_DEPRECATION_WARNINGS,
3782-
KALEIDO_DEPRECATION_MSG,
3783-
ORCA_DEPRECATION_MSG,
3784-
ENGINE_PARAM_DEPRECATION_MSG,
3785-
)
37863758

3787-
if ENABLE_KALEIDO_V0_DEPRECATION_WARNINGS:
3788-
if (
3789-
kwargs.get("engine", None) in {None, "auto", "kaleido"}
3790-
and kaleido_available()
3791-
and kaleido_major() < 1
3792-
):
3793-
warnings.warn(KALEIDO_DEPRECATION_MSG, DeprecationWarning, stacklevel=2)
3794-
if kwargs.get("engine", None) == "orca":
3795-
warnings.warn(ORCA_DEPRECATION_MSG, DeprecationWarning, stacklevel=2)
3796-
if kwargs.get("engine", None):
3797-
warnings.warn(
3798-
ENGINE_PARAM_DEPRECATION_MSG, DeprecationWarning, stacklevel=2
3799-
)
3759+
import plotly.io as pio
38003760

38013761
return pio.to_image(self, *args, **kwargs)
38023762

@@ -3807,91 +3767,50 @@ def write_image(self, *args, **kwargs):
38073767
38083768
Parameters
38093769
----------
3770+
fig:
3771+
Figure object or dict representing a figure
3772+
38103773
file: str or writeable
38113774
A string representing a local file path or a writeable object
38123775
(e.g. a pathlib.Path object or an open file descriptor)
38133776
3814-
format: str or None
3815-
The desired image format. One of
3816-
- 'png'
3817-
- 'jpg' or 'jpeg'
3818-
- 'webp'
3819-
- 'svg'
3820-
- 'pdf'
3821-
- 'eps' (deprecated) (Requires the poppler library to be installed)
3822-
3823-
If not specified and `file` is a string then this will default to the
3824-
file extension. If not specified and `file` is not a string then this
3825-
will default to:
3826-
- `plotly.io.defaults.default_format` if engine is "kaleido"
3827-
- `plotly.io.orca.config.default_format` if engine is "orca" (deprecated)
3828-
3829-
width: int or None
3830-
The width of the exported image in layout pixels. If the `scale`
3831-
property is 1.0, this will also be the width of the exported image
3832-
in physical pixels.
3833-
3834-
If not specified, will default to:
3835-
- `plotly.io.defaults.default_width` if engine is "kaleido"
3836-
- `plotly.io.orca.config.default_width` if engine is "orca" (deprecated)
3837-
3838-
height: int or None
3839-
The height of the exported image in layout pixels. If the `scale`
3840-
property is 1.0, this will also be the height of the exported image
3841-
in physical pixels.
3842-
3843-
If not specified, will default to:
3844-
- `plotly.io.defaults.default_height` if engine is "kaleido"
3845-
- `plotly.io.orca.config.default_height` if engine is "orca" (deprecated)
3846-
3847-
scale: int or float or None
3848-
The scale factor to use when exporting the figure. A scale factor
3849-
larger than 1.0 will increase the image resolution with respect
3850-
to the figure's layout pixel dimensions. Whereas as scale factor of
3851-
less than 1.0 will decrease the image resolution.
3852-
3853-
If not specified, will default to:
3854-
- `plotly.io.defaults.default_scale` if engine is "kaleido"
3855-
- `plotly.io.orca.config.default_scale` if engine is "orca" (deprecated)
3777+
format: str
3778+
(optional) The desired image format. One of:
3779+
- 'png'
3780+
- 'jpg' or 'jpeg'
3781+
- 'webp'
3782+
- 'svg'
3783+
- 'pdf'
3784+
Defaults to the file extension of `file`, if given; otherwise
3785+
defaults to `plotly.io.defaults.default_format`.
3786+
3787+
width: int
3788+
(optional) The width of the exported image in layout pixels. If the
3789+
`scale` property is 1.0, this will also be the width of the exported image
3790+
in physical pixels. Defaults to `plotly.io.defaults.default_width`.
3791+
3792+
height: int
3793+
(optional) The height of the exported image in layout pixels. If the
3794+
`scale` property is 1.0, this will also be the height of the exported image
3795+
in physical pixels. Defaults to `plotly.io.defaults.default_height`.
3796+
3797+
scale: int or float
3798+
(optional) The scale factor to use when exporting the figure. A scale
3799+
factor larger than 1.0 will increase the image resolution with respect
3800+
to the figure's layout pixel dimensions, while a scale factor of
3801+
less than 1.0 will decrease the image resolution. Defaults to
3802+
`plotly.io.defaults.default_scale`.
38563803
38573804
validate: bool
3858-
True if the figure should be validated before being converted to
3859-
an image, False otherwise.
3860-
3861-
engine (deprecated): str
3862-
Image export engine to use. This parameter is deprecated and Orca engine support will be
3863-
dropped in the next major Plotly version. Until then, the following values are supported:
3864-
- "kaleido": Use Kaleido for image export
3865-
- "orca": Use Orca for image export
3866-
- "auto" (default): Use Kaleido if installed, otherwise use Orca
3805+
(optional) True if the figure should be validated before being converted
3806+
to an image, False otherwise. Defaults to True.
38673807
38683808
Returns
38693809
-------
38703810
None
38713811
"""
38723812
import plotly.io as pio
3873-
from plotly.io.kaleido import (
3874-
kaleido_available,
3875-
kaleido_major,
3876-
ENABLE_KALEIDO_V0_DEPRECATION_WARNINGS,
3877-
KALEIDO_DEPRECATION_MSG,
3878-
ORCA_DEPRECATION_MSG,
3879-
ENGINE_PARAM_DEPRECATION_MSG,
3880-
)
38813813

3882-
if ENABLE_KALEIDO_V0_DEPRECATION_WARNINGS:
3883-
if (
3884-
kwargs.get("engine", None) in {None, "auto", "kaleido"}
3885-
and kaleido_available()
3886-
and kaleido_major() < 1
3887-
):
3888-
warnings.warn(KALEIDO_DEPRECATION_MSG, DeprecationWarning, stacklevel=2)
3889-
if kwargs.get("engine", None) == "orca":
3890-
warnings.warn(ORCA_DEPRECATION_MSG, DeprecationWarning, stacklevel=2)
3891-
if kwargs.get("engine", None):
3892-
warnings.warn(
3893-
ENGINE_PARAM_DEPRECATION_MSG, DeprecationWarning, stacklevel=2
3894-
)
38953814
return pio.write_image(self, *args, **kwargs)
38963815

38973816
# Static helpers

plotly/io/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
write_images,
1111
full_figure_for_development,
1212
)
13-
from . import orca, kaleido
1413
from . import json
1514
from ._json import to_json, from_json, read_json, write_json
1615
from ._templates import templates, to_templated
@@ -23,7 +22,6 @@
2322
"to_image",
2423
"write_image",
2524
"write_images",
26-
"orca",
2725
"json",
2826
"to_json",
2927
"from_json",
@@ -43,7 +41,7 @@
4341
else:
4442
__all__, __getattr__, __dir__ = relative_import(
4543
__name__,
46-
[".orca", ".kaleido", ".json", ".base_renderers"],
44+
[".kaleido", ".json", ".base_renderers"],
4745
[
4846
"._kaleido.to_image",
4947
"._kaleido.write_image",

0 commit comments

Comments
 (0)