Skip to content

Commit 7f841b2

Browse files
emilyklayjayt
authored andcommitted
lint
1 parent 53da5d6 commit 7f841b2

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/py/kaleido/_utils.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import asyncio
2-
from importlib.metadata import version, PackageNotFoundError
32
import traceback
4-
from functools import partial
53
import warnings
4+
from functools import partial
5+
from importlib.metadata import PackageNotFoundError, version
66

77
import logistro
88
from packaging.version import Version
@@ -18,7 +18,8 @@ async def to_thread(func, *args, **kwargs):
1818

1919
def warn_incompatible_plotly():
2020
"""
21-
Check if the installed Plotly version (if any) is compatible with this version of Kaleido.
21+
Check if installed Plotly version (if any) is compatible with this Kaleido version.
22+
2223
If not, display a warning.
2324
"""
2425
try:
@@ -29,15 +30,20 @@ def warn_incompatible_plotly():
2930
warnings.warn(
3031
"\n\n"
3132
f"Warning: You have Plotly version {installed_plotly_version}, "
32-
f"which is not compatible with this version of Kaleido ({installed_kaleido_version}).\n\n"
33-
"This means that image generation (e.g. `fig.write_image()`) will not work.\n\n"
34-
f"Please upgrade Plotly to at least {min_compatible_plotly_version}, or downgrade Kaleido."
33+
"which is not compatible with this version of "
34+
f"Kaleido ({installed_kaleido_version}).\n\n"
35+
"This means that image generation (e.g. `fig.write_image()`) "
36+
"will not work.\n\n"
37+
f"Please upgrade Plotly to at least {min_compatible_plotly_version}, "
38+
"or downgrade Kaleido."
3539
"\n\n",
3640
UserWarning,
41+
stacklevel=2,
3742
)
3843
except PackageNotFoundError:
3944
# If Plotly is not installed, there's nothing to worry about
4045
pass
46+
# ruff: noqa: BLE001
4147
except Exception as e:
4248
# If another error occurs, log it but do not raise
4349
# Since this compatibility check is just a convenience,

src/py/kaleido/kaleido.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
_logger = logistro.getLogger(__name__)
2222

23-
# Show a warning if the installed Plotly version is incompatible with this version of Kaleido
23+
# Show a warning if the installed Plotly version
24+
# is incompatible with this version of Kaleido
2425
warn_incompatible_plotly()
2526

2627

0 commit comments

Comments
 (0)