Skip to content

Commit 0e315dd

Browse files
committed
Remove plotly dep and make import optional.
1 parent 74048f4 commit 0e315dd

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/py/kaleido/kaleido.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212

1313
import choreographer as choreo
1414
import logistro
15-
from choreographer import channels
1615
from choreographer.errors import ChromeNotFoundError
1716
from choreographer.utils import TmpDirectory
18-
from plotly.utils import PlotlyJSONEncoder
1917

2018
from ._fig_tools import _is_figurish, build_fig_spec
2119
from ._kaleido_tab import _KaleidoTab
@@ -30,7 +28,14 @@
3028

3129
_logger = logistro.getLogger(__name__)
3230

33-
channels.register_custom_encoder(PlotlyJSONEncoder)
31+
try:
32+
from choreographer import channels
33+
from plotly.utils import PlotlyJSONEncoder
34+
35+
channels.register_custom_encoder(PlotlyJSONEncoder)
36+
_logger.debug("Successfully registered PlotlyJSONEncoder.")
37+
except ImportError:
38+
_logger.debug("Couldn't import plotly- skipping.")
3439

3540
# Show a warning if the installed Plotly version
3641
# is incompatible with this version of Kaleido

src/py/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ dependencies = [
3030
"logistro>=1.0.8",
3131
"orjson>=3.10.15",
3232
"packaging",
33-
"plotly>=6.3.0",
3433
"pytest-timeout>=2.4.0",
3534
]
3635

0 commit comments

Comments
 (0)