1
1
import asyncio
2
- from importlib .metadata import version , PackageNotFoundError
3
2
import traceback
4
- from functools import partial
5
3
import warnings
4
+ from functools import partial
5
+ from importlib .metadata import PackageNotFoundError , version
6
6
7
7
import logistro
8
8
from packaging .version import Version
@@ -18,7 +18,8 @@ async def to_thread(func, *args, **kwargs):
18
18
19
19
def warn_incompatible_plotly ():
20
20
"""
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
+
22
23
If not, display a warning.
23
24
"""
24
25
try :
@@ -29,15 +30,20 @@ def warn_incompatible_plotly():
29
30
warnings .warn (
30
31
"\n \n "
31
32
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."
35
39
"\n \n " ,
36
40
UserWarning ,
41
+ stacklevel = 2 ,
37
42
)
38
43
except PackageNotFoundError :
39
44
# If Plotly is not installed, there's nothing to worry about
40
45
pass
46
+ # ruff: noqa: BLE001
41
47
except Exception as e :
42
48
# If another error occurs, log it but do not raise
43
49
# Since this compatibility check is just a convenience,
0 commit comments