@@ -33,17 +33,25 @@ async def calc_fig(
33
33
opts = None ,
34
34
* ,
35
35
topojson = None ,
36
+ kopts = None ,
36
37
):
37
38
"""
38
39
Return binary for plotly figure.
39
40
40
41
A convenience wrapper for `Kaleido.calc_fig()` which starts a `Kaleido` and
41
42
executes the `calc_fig()`.
43
+ It takes an additional argument, `kopts`, a dictionary of arguments to pass
44
+ to the kaleido process. See the `kaleido.Kaleido` docs. However,
45
+ `calc_fig()` will never use more than one processor, so any `n` value will
46
+ be overridden.
47
+
42
48
43
49
See documentation for `Kaleido.calc_fig()`.
44
50
45
51
"""
46
- async with Kaleido (n = 1 ) as k :
52
+ kopts = kopts or {}
53
+ kopts ["n" ] = 1
54
+ async with Kaleido (** kopts ) as k :
47
55
return await k .calc_fig (
48
56
fig ,
49
57
path = path ,
@@ -60,20 +68,21 @@ async def write_fig( # noqa: PLR0913 (too many args, complexity)
60
68
topojson = None ,
61
69
error_log = None ,
62
70
profiler = None ,
63
- n = 1 ,
71
+ kopts = None ,
64
72
):
65
73
"""
66
74
Write a plotly figure(s) to a file.
67
75
68
76
A convenience wrapper for `Kaleido.write_fig()` which starts a `Kaleido` and
69
77
executes the `write_fig()`.
70
- It takes one additional argument, `n`, which can be used to set the number
71
- of processes.
78
+ It takes an additional argument, `kopts`, a dictionary of arguments to pass
79
+ to the kaleido process. See the `kaleido.Kaleido` docs.
80
+
72
81
73
- See documentation for `Kaleido.write_fig()`.
82
+ See documentation for `Kaleido.write_fig()` for the other arguments .
74
83
75
84
"""
76
- async with Kaleido (n = n ) as k :
85
+ async with Kaleido (** ( kopts or {}) ) as k :
77
86
await k .write_fig (
78
87
fig ,
79
88
path = path ,
@@ -89,20 +98,21 @@ async def write_fig_from_object(
89
98
* ,
90
99
error_log = None ,
91
100
profiler = None ,
92
- n = 1 ,
101
+ kopts = None ,
93
102
):
94
103
"""
95
104
Write a plotly figure(s) to a file.
96
105
97
106
A convenience wrapper for `Kaleido.write_fig_from_object()` which starts a
98
107
`Kaleido` and executes the `write_fig_from_object()`
99
- It takes one additional argument, `n `, which can be used to set the number
100
- of processes .
108
+ It takes an additional argument, `kopts `, a dictionary of arguments to pass
109
+ to the kaleido process. See the `kaleido.Kaleido` docs .
101
110
102
- See documentation for `Kaleido.write_fig_from_object()`.
111
+ See documentation for `Kaleido.write_fig_from_object()` for the other
112
+ arguments.
103
113
104
114
"""
105
- async with Kaleido (n = n ) as k :
115
+ async with Kaleido (** ( kopts or {}) ) as k :
106
116
await k .write_fig_from_object (
107
117
generator ,
108
118
error_log = error_log ,
0 commit comments