Skip to content

Commit 7ef02ae

Browse files
authored
Merge pull request #5677 from plotly/drop-kaleido-v0
Drop support for Kaleido v0.x, and Orca
2 parents 623abd8 + e067cd0 commit 7ef02ae

16 files changed

Lines changed: 371 additions & 2385 deletions

File tree

.github/workflows/run-pytest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ jobs:
135135
python -m pytest -x test_init/test_lazy_imports.py
136136
137137
test-kaleido-v0:
138-
name: Optional tests (Kaleido only), Kaleido v0 (Python 3.12, kaleido 0.2.1)
138+
name: Kaleido v0 RuntimeError verification (Python 3.12, kaleido 0.2.1)
139139
runs-on: ubuntu-latest
140140
steps:
141141
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -157,7 +157,7 @@ jobs:
157157
uv pip uninstall kaleido
158158
uv pip install kaleido==0.2.1
159159
python --version
160-
- name: Test plotly.io image output with Kaleido v0
160+
- name: Test that plotly.io raises correct error with Kaleido v0
161161
run: |
162162
source .venv/bin/activate
163-
python -m pytest tests/test_optional/test_kaleido
163+
python -m pytest tests/test_optional/test_kaleido/test_kaleido_v0_error.py

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
0
22
0.html
33
iframe_figures/
4-
tests/test_orca/images/linux/failed/
54

65
*.egg-info
76

@@ -49,8 +48,6 @@ plotly.egg-info/
4948
# macOS utility file
5049
**/.DS_Store
5150

52-
tests/test_orca/images/*/failed
53-
tests/test_orca/images/*/tmp
5451
tests/test_core/test_offline/plotly.min.js
5552
temp-plot.html
5653
.vscode

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
66

77
### Removed
88
- Remove the deprecated Figure Factory functions `create_2d_density`, `create_annotated_heatmap`, `create_bullet`, `create_candlestick`, `create_choropleth`, `create_distplot`, `create_facet_grid`, `create_gantt`, `create_hexbin_mapbox`, `create_ohlc`, `create_scatterplotmatrix`, and `create_violin` [[#5627](https://github.com/plotly/plotly.py/pull/5627)]
9+
- Remove support for Kaleido versions less than v1.0.0 for static image generation [[#5677](https://github.com/plotly/plotly.py/pull/5677)]
10+
- Remove support for Orca for static image generation [[#5677](https://github.com/plotly/plotly.py/pull/5677)]
11+
- Remove `engine` argument from functions `fig.write_image()`,`fig.to_image()`, `pio.write_image()`, `pio.write_images()`, `pio.to_image()`, `pio.full_figure_for_development()`, and from renderer constructors [[#5677](https://github.com/plotly/plotly.py/pull/5677)]
912

1013
### Fixed
1114
- Raise a clear `ValueError` when an unsupported marginal plot type is passed to Plotly Express, instead of failing later with a cryptic `'NoneType' object has no attribute 'constructor'` message [[#5625](https://github.com/plotly/plotly.py/pull/5625)], with thanks to @eugen-goebel for the contribution!

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,10 @@ conda install jupyter anywidget
106106
### Static Image Export
107107

108108
plotly.py supports [static image export](https://plotly.com/python/static-image-export/),
109-
using either the [`kaleido`](https://github.com/plotly/Kaleido)
110-
package (recommended, supported as of `plotly` version 4.9) or the [orca](https://github.com/plotly/orca)
111-
command line utility (legacy as of `plotly` version 4.9).
109+
using the [`kaleido`](https://github.com/plotly/Kaleido)
110+
package (version 1.0 or greater).
112111

113-
#### Kaleido
114-
115-
The [`kaleido`](https://github.com/plotly/Kaleido) package has no dependencies and can be installed
112+
Kaleido has minimal dependencies and can be installed
116113
using pip
117114

118115
```
@@ -125,6 +122,12 @@ or conda
125122
conda install -c conda-forge python-kaleido
126123
```
127124

125+
Kaleido requires Chrome or Chromium to generate images. By default, Kaleido will use the Chrome or Chromium version already installed on your system. If you don't have it installed or Kaleido can't find it, you may need to install it by running the command:
126+
127+
`plotly_get_chrome`
128+
129+
on your command line.
130+
128131
## Copyright and Licenses
129132

130133
Code and documentation copyright 2019 Plotly, Inc.

plotly/basedatatypes.py

Lines changed: 56 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,9 +3462,6 @@ def full_figure_for_development(self, warn=True, as_dict=False):
34623462
34633463
Parameters
34643464
----------
3465-
fig:
3466-
Figure object or dict representing a figure
3467-
34683465
warn: bool
34693466
If False, suppress warnings about not using this in production.
34703467
@@ -3717,86 +3714,43 @@ def to_image(self, *args, **kwargs):
37173714
37183715
Parameters
37193716
----------
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)
3717+
format: str
3718+
(optional) The desired image format. One of:
3719+
- 'png'
3720+
- 'jpg' or 'jpeg'
3721+
- 'webp'
3722+
- 'svg'
3723+
- 'pdf'
3724+
Defaults to `plotly.io.defaults.default_format`.
3725+
3726+
width: int
3727+
(optional) The width of the exported image in layout pixels. If the
3728+
`scale` property is 1.0, this will also be the width of the exported image
3729+
in physical pixels. Defaults to `plotly.io.defaults.default_width`.
3730+
3731+
height: int
3732+
(optional) The height of the exported image in layout pixels. If the
3733+
`scale` property is 1.0, this will also be the height of the exported image
3734+
in physical pixels. Defaults to `plotly.io.defaults.default_height`.
3735+
3736+
scale: int or float
3737+
(optional) The scale factor to use when exporting the figure. A scale
3738+
factor larger than 1.0 will increase the image resolution with respect
3739+
to the figure's layout pixel dimensions, while a scale factor of
3740+
less than 1.0 will decrease the image resolution. Defaults to
3741+
`plotly.io.defaults.default_scale`.
37603742
37613743
validate: bool
3762-
True if the figure should be validated before being converted to
3763-
an image, False otherwise.
3764-
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
3744+
(optional) True if the figure should be validated before being converted
3745+
to an image, False otherwise. Defaults to True.
37713746
37723747
Returns
37733748
-------
37743749
bytes
37753750
The image data
37763751
"""
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-
)
37863752

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-
)
3753+
import plotly.io as pio
38003754

38013755
return pio.to_image(self, *args, **kwargs)
38023756

@@ -3811,87 +3765,43 @@ def write_image(self, *args, **kwargs):
38113765
A string representing a local file path or a writeable object
38123766
(e.g. a pathlib.Path object or an open file descriptor)
38133767
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)
3768+
format: str
3769+
(optional) The desired image format. One of:
3770+
- 'png'
3771+
- 'jpg' or 'jpeg'
3772+
- 'webp'
3773+
- 'svg'
3774+
- 'pdf'
3775+
Defaults to the file extension of `file`, if given; otherwise
3776+
defaults to `plotly.io.defaults.default_format`.
3777+
3778+
width: int
3779+
(optional) The width of the exported image in layout pixels. If the
3780+
`scale` property is 1.0, this will also be the width of the exported image
3781+
in physical pixels. Defaults to `plotly.io.defaults.default_width`.
3782+
3783+
height: int
3784+
(optional) The height of the exported image in layout pixels. If the
3785+
`scale` property is 1.0, this will also be the height of the exported image
3786+
in physical pixels. Defaults to `plotly.io.defaults.default_height`.
3787+
3788+
scale: int or float
3789+
(optional) The scale factor to use when exporting the figure. A scale
3790+
factor larger than 1.0 will increase the image resolution with respect
3791+
to the figure's layout pixel dimensions, while a scale factor of
3792+
less than 1.0 will decrease the image resolution. Defaults to
3793+
`plotly.io.defaults.default_scale`.
38563794
38573795
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
3796+
(optional) True if the figure should be validated before being converted
3797+
to an image, False otherwise. Defaults to True.
38673798
38683799
Returns
38693800
-------
38703801
None
38713802
"""
38723803
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-
)
38813804

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-
)
38953805
return pio.write_image(self, *args, **kwargs)
38963806

38973807
# 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)