vl-convert-python 2.0.0rc2__cp39-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vl_convert/__init__.py +5 -0
- vl_convert/__init__.pyi +1843 -0
- vl_convert/py.typed +0 -0
- vl_convert/vl_convert.pyd +0 -0
- vl_convert_python-2.0.0rc2.dist-info/METADATA +228 -0
- vl_convert_python-2.0.0rc2.dist-info/RECORD +9 -0
- vl_convert_python-2.0.0rc2.dist-info/WHEEL +4 -0
- vl_convert_python-2.0.0rc2.dist-info/licenses/LICENSE +11 -0
- vl_convert_python-2.0.0rc2.dist-info/sboms/vl-convert-python.cyclonedx.json +38068 -0
vl_convert/__init__.pyi
ADDED
|
@@ -0,0 +1,1843 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
if TYPE_CHECKING:
|
|
4
|
+
import sys
|
|
5
|
+
from typing import Any, Literal, TypedDict
|
|
6
|
+
|
|
7
|
+
if sys.version_info >= (3, 10):
|
|
8
|
+
from typing import TypeAlias
|
|
9
|
+
else:
|
|
10
|
+
from typing_extensions import TypeAlias
|
|
11
|
+
|
|
12
|
+
FormatLocaleName: TypeAlias = Literal[
|
|
13
|
+
"ar-001",
|
|
14
|
+
"ar-AE",
|
|
15
|
+
"ar-BH",
|
|
16
|
+
"ar-DJ",
|
|
17
|
+
"ar-DZ",
|
|
18
|
+
"ar-EG",
|
|
19
|
+
"ar-EH",
|
|
20
|
+
"ar-ER",
|
|
21
|
+
"ar-IL",
|
|
22
|
+
"ar-IQ",
|
|
23
|
+
"ar-JO",
|
|
24
|
+
"ar-KM",
|
|
25
|
+
"ar-KW",
|
|
26
|
+
"ar-LB",
|
|
27
|
+
"ar-LY",
|
|
28
|
+
"ar-MA",
|
|
29
|
+
"ar-MR",
|
|
30
|
+
"ar-OM",
|
|
31
|
+
"ar-PS",
|
|
32
|
+
"ar-QA",
|
|
33
|
+
"ar-SA",
|
|
34
|
+
"ar-SD",
|
|
35
|
+
"ar-SO",
|
|
36
|
+
"ar-SS",
|
|
37
|
+
"ar-SY",
|
|
38
|
+
"ar-TD",
|
|
39
|
+
"ar-TN",
|
|
40
|
+
"ar-YE",
|
|
41
|
+
"ca-ES",
|
|
42
|
+
"cs-CZ",
|
|
43
|
+
"da-DK",
|
|
44
|
+
"de-CH",
|
|
45
|
+
"de-DE",
|
|
46
|
+
"en-CA",
|
|
47
|
+
"en-GB",
|
|
48
|
+
"en-IE",
|
|
49
|
+
"en-IN",
|
|
50
|
+
"en-US",
|
|
51
|
+
"es-BO",
|
|
52
|
+
"es-ES",
|
|
53
|
+
"es-MX",
|
|
54
|
+
"fi-FI",
|
|
55
|
+
"fr-CA",
|
|
56
|
+
"fr-FR",
|
|
57
|
+
"he-IL",
|
|
58
|
+
"hu-HU",
|
|
59
|
+
"it-IT",
|
|
60
|
+
"ja-JP",
|
|
61
|
+
"ko-KR",
|
|
62
|
+
"mk-MK",
|
|
63
|
+
"nl-NL",
|
|
64
|
+
"pl-PL",
|
|
65
|
+
"pt-BR",
|
|
66
|
+
"pt-PT",
|
|
67
|
+
"ru-RU",
|
|
68
|
+
"sl-SI",
|
|
69
|
+
"sv-SE",
|
|
70
|
+
"uk-UA",
|
|
71
|
+
"zh-CN",
|
|
72
|
+
]
|
|
73
|
+
TimeFormatLocaleName: TypeAlias = Literal[
|
|
74
|
+
"ar-EG",
|
|
75
|
+
"ar-SY",
|
|
76
|
+
"ca-ES",
|
|
77
|
+
"cs-CZ",
|
|
78
|
+
"da-DK",
|
|
79
|
+
"de-CH",
|
|
80
|
+
"de-DE",
|
|
81
|
+
"en-CA",
|
|
82
|
+
"en-GB",
|
|
83
|
+
"en-US",
|
|
84
|
+
"es-ES",
|
|
85
|
+
"es-MX",
|
|
86
|
+
"fa-IR",
|
|
87
|
+
"fi-FI",
|
|
88
|
+
"fr-CA",
|
|
89
|
+
"fr-FR",
|
|
90
|
+
"he-IL",
|
|
91
|
+
"hr-HR",
|
|
92
|
+
"hu-HU",
|
|
93
|
+
"it-IT",
|
|
94
|
+
"ja-JP",
|
|
95
|
+
"ko-KR",
|
|
96
|
+
"mk-MK",
|
|
97
|
+
"nb-NO",
|
|
98
|
+
"nl-BE",
|
|
99
|
+
"nl-NL",
|
|
100
|
+
"pl-PL",
|
|
101
|
+
"pt-BR",
|
|
102
|
+
"ru-RU",
|
|
103
|
+
"sv-SE",
|
|
104
|
+
"tr-TR",
|
|
105
|
+
"uk-UA",
|
|
106
|
+
"vi-VN",
|
|
107
|
+
"zh-CN",
|
|
108
|
+
"zh-TW",
|
|
109
|
+
]
|
|
110
|
+
VegaThemes: TypeAlias = Literal[
|
|
111
|
+
"carbong10",
|
|
112
|
+
"carbong100",
|
|
113
|
+
"carbong90",
|
|
114
|
+
"carbonwhite",
|
|
115
|
+
"dark",
|
|
116
|
+
"excel",
|
|
117
|
+
"fivethirtyeight",
|
|
118
|
+
"ggplot2",
|
|
119
|
+
"googlecharts",
|
|
120
|
+
"latimes",
|
|
121
|
+
"powerbi",
|
|
122
|
+
"quartz",
|
|
123
|
+
"urbaninstitute",
|
|
124
|
+
"vox",
|
|
125
|
+
]
|
|
126
|
+
Renderer: TypeAlias = Literal["canvas", "hybrid", "svg"]
|
|
127
|
+
FormatLocale: TypeAlias = FormatLocaleName | dict[str, Any]
|
|
128
|
+
TimeFormatLocale: TypeAlias = TimeFormatLocaleName | dict[str, Any]
|
|
129
|
+
VlSpec: TypeAlias = str | dict[str, Any]
|
|
130
|
+
|
|
131
|
+
class GoogleFontSource(TypedDict):
|
|
132
|
+
type: Literal["google"]
|
|
133
|
+
font_id: str
|
|
134
|
+
|
|
135
|
+
class LocalFontSource(TypedDict):
|
|
136
|
+
type: Literal["local"]
|
|
137
|
+
|
|
138
|
+
FontSource: TypeAlias = GoogleFontSource | LocalFontSource
|
|
139
|
+
|
|
140
|
+
class GoogleFontSpec(TypedDict, total=False):
|
|
141
|
+
family: str # required
|
|
142
|
+
variants: list[tuple[int, str]] # optional: [(400, "normal"), (700, "italic")]
|
|
143
|
+
|
|
144
|
+
class FontVariant(TypedDict):
|
|
145
|
+
weight: str
|
|
146
|
+
style: str
|
|
147
|
+
font_face: str | None
|
|
148
|
+
|
|
149
|
+
class FontInfo(TypedDict):
|
|
150
|
+
name: str
|
|
151
|
+
source: FontSource
|
|
152
|
+
variants: list[FontVariant]
|
|
153
|
+
url: str | None
|
|
154
|
+
link_tag: str | None
|
|
155
|
+
import_rule: str | None
|
|
156
|
+
|
|
157
|
+
class ConverterConfig(TypedDict):
|
|
158
|
+
num_workers: int
|
|
159
|
+
base_url: str | bool
|
|
160
|
+
allowed_base_urls: list[str]
|
|
161
|
+
auto_google_fonts: bool
|
|
162
|
+
embed_local_fonts: bool
|
|
163
|
+
subset_fonts: bool
|
|
164
|
+
missing_fonts: Literal["fallback", "warn", "error"]
|
|
165
|
+
google_fonts: list[GoogleFontSpec]
|
|
166
|
+
google_font_variant_threshold: int | None
|
|
167
|
+
max_v8_heap_size_mb: int | None
|
|
168
|
+
max_v8_execution_time_secs: int | None
|
|
169
|
+
gc_after_conversion: bool
|
|
170
|
+
vega_plugins: list[str]
|
|
171
|
+
plugin_import_domains: list[str]
|
|
172
|
+
allow_per_request_plugins: bool
|
|
173
|
+
max_ephemeral_workers: int | None
|
|
174
|
+
allow_google_fonts: bool
|
|
175
|
+
per_request_plugin_import_domains: list[str]
|
|
176
|
+
default_theme: str | None
|
|
177
|
+
default_format_locale: str | dict[str, Any] | None
|
|
178
|
+
default_time_format_locale: str | dict[str, Any] | None
|
|
179
|
+
themes: dict[str, dict[str, Any]]
|
|
180
|
+
|
|
181
|
+
__all__ = [
|
|
182
|
+
"asyncio",
|
|
183
|
+
"configure",
|
|
184
|
+
"load_config",
|
|
185
|
+
"get_config_path",
|
|
186
|
+
"get_format_locale",
|
|
187
|
+
"get_config",
|
|
188
|
+
"get_local_tz",
|
|
189
|
+
"get_themes",
|
|
190
|
+
"get_time_format_locale",
|
|
191
|
+
"javascript_bundle",
|
|
192
|
+
"register_font_directory",
|
|
193
|
+
"set_font_directories",
|
|
194
|
+
"current_font_directories",
|
|
195
|
+
"google_fonts_cache_dir",
|
|
196
|
+
"google_fonts_cache_size_mb",
|
|
197
|
+
"set_google_fonts_cache_size_mb",
|
|
198
|
+
"warm_up_workers",
|
|
199
|
+
"get_worker_memory_usage",
|
|
200
|
+
"svg_to_jpeg",
|
|
201
|
+
"svg_to_pdf",
|
|
202
|
+
"svg_to_png",
|
|
203
|
+
"vega_fonts",
|
|
204
|
+
"vega_to_html",
|
|
205
|
+
"vega_to_jpeg",
|
|
206
|
+
"vega_to_pdf",
|
|
207
|
+
"vega_to_png",
|
|
208
|
+
"vega_to_scenegraph",
|
|
209
|
+
"vega_to_svg",
|
|
210
|
+
"vega_to_url",
|
|
211
|
+
"vegalite_fonts",
|
|
212
|
+
"vegalite_to_html",
|
|
213
|
+
"vegalite_to_jpeg",
|
|
214
|
+
"vegalite_to_pdf",
|
|
215
|
+
"vegalite_to_png",
|
|
216
|
+
"vegalite_to_scenegraph",
|
|
217
|
+
"vegalite_to_svg",
|
|
218
|
+
"vegalite_to_url",
|
|
219
|
+
"vegalite_to_vega",
|
|
220
|
+
"get_vega_version",
|
|
221
|
+
"get_vega_themes_version",
|
|
222
|
+
"get_vega_embed_version",
|
|
223
|
+
"get_vegalite_versions",
|
|
224
|
+
]
|
|
225
|
+
|
|
226
|
+
def get_format_locale(name: FormatLocaleName) -> dict[str, Any]:
|
|
227
|
+
"""
|
|
228
|
+
Get the d3-format locale dict for a named locale.
|
|
229
|
+
|
|
230
|
+
See https://github.com/d3/d3-format/tree/main/locale for available names
|
|
231
|
+
|
|
232
|
+
Parameters
|
|
233
|
+
----------
|
|
234
|
+
name
|
|
235
|
+
d3-format locale name (e.g. 'it-IT')
|
|
236
|
+
|
|
237
|
+
Returns
|
|
238
|
+
-------
|
|
239
|
+
d3-format locale dict
|
|
240
|
+
"""
|
|
241
|
+
...
|
|
242
|
+
|
|
243
|
+
def get_local_tz() -> str | None:
|
|
244
|
+
"""
|
|
245
|
+
Get the named local timezone that Vega uses to perform timezone calculations.
|
|
246
|
+
|
|
247
|
+
Returns
|
|
248
|
+
-------
|
|
249
|
+
Named local timezone (e.g. "America/New_York"), or None if the local timezone
|
|
250
|
+
cannot be determined.
|
|
251
|
+
"""
|
|
252
|
+
...
|
|
253
|
+
|
|
254
|
+
def get_themes() -> dict[VegaThemes, dict[str, Any]]:
|
|
255
|
+
"""
|
|
256
|
+
Get the config dict for each built-in theme.
|
|
257
|
+
|
|
258
|
+
Returns
|
|
259
|
+
-------
|
|
260
|
+
dict from theme name to config object.
|
|
261
|
+
"""
|
|
262
|
+
...
|
|
263
|
+
|
|
264
|
+
def get_time_format_locale(name: TimeFormatLocaleName) -> dict[str, Any]:
|
|
265
|
+
"""
|
|
266
|
+
Get the d3-time-format locale dict for a named locale.
|
|
267
|
+
|
|
268
|
+
See https://github.com/d3/d3-time-format/tree/main/locale for available names
|
|
269
|
+
|
|
270
|
+
Parameters
|
|
271
|
+
----------
|
|
272
|
+
name
|
|
273
|
+
d3-time-format locale name (e.g. 'it-IT')
|
|
274
|
+
|
|
275
|
+
Returns
|
|
276
|
+
-------
|
|
277
|
+
d3-time-format locale dict.
|
|
278
|
+
"""
|
|
279
|
+
...
|
|
280
|
+
|
|
281
|
+
def javascript_bundle(snippet: str | None = None, vl_version: str | None = None) -> str:
|
|
282
|
+
"""
|
|
283
|
+
Create a JavaScript bundle containing the Vega Embed, Vega-Lite, and Vega libraries.
|
|
284
|
+
|
|
285
|
+
Optionally, a JavaScript snippet may be provided that references Vega Embed
|
|
286
|
+
as `vegaEmbed`, Vega-Lite as `vegaLite`, Vega and `vega`, and the lodash.debounce
|
|
287
|
+
function as `lodashDebounce`.
|
|
288
|
+
|
|
289
|
+
The resulting string will include these JavaScript libraries and all of their
|
|
290
|
+
dependencies.
|
|
291
|
+
This bundle result is suitable for inclusion in an HTML <script> tag with
|
|
292
|
+
no external dependencies required.
|
|
293
|
+
The default snippet assigns `vegaEmbed`, `vegaLite`, and `vega` to the global
|
|
294
|
+
window object, making them available globally to other script tags.
|
|
295
|
+
|
|
296
|
+
Parameters
|
|
297
|
+
----------
|
|
298
|
+
snippet
|
|
299
|
+
An ES6 JavaScript snippet which includes no imports
|
|
300
|
+
vl_version
|
|
301
|
+
Vega-Lite library version string (e.g. 'v5.15') (default to latest)
|
|
302
|
+
|
|
303
|
+
Returns
|
|
304
|
+
-------
|
|
305
|
+
Bundled snippet with all dependencies.
|
|
306
|
+
"""
|
|
307
|
+
...
|
|
308
|
+
|
|
309
|
+
def register_font_directory(font_dir: str) -> None:
|
|
310
|
+
"""
|
|
311
|
+
Register a directory of fonts for use in subsequent conversions.
|
|
312
|
+
|
|
313
|
+
Parameters
|
|
314
|
+
----------
|
|
315
|
+
font_dir
|
|
316
|
+
Absolute path to a directory containing font files
|
|
317
|
+
|
|
318
|
+
Returns
|
|
319
|
+
-------
|
|
320
|
+
None
|
|
321
|
+
"""
|
|
322
|
+
...
|
|
323
|
+
|
|
324
|
+
def set_font_directories(font_dirs: list[str]) -> None:
|
|
325
|
+
"""
|
|
326
|
+
Replace the registered font directories with the given list.
|
|
327
|
+
|
|
328
|
+
The replacement list is authoritative. Directories absent from
|
|
329
|
+
``font_dirs`` are removed from the global registry and from subsequent
|
|
330
|
+
font resolution. Pass an empty list to clear all registrations.
|
|
331
|
+
|
|
332
|
+
Parameters
|
|
333
|
+
----------
|
|
334
|
+
font_dirs
|
|
335
|
+
Absolute paths to directories containing font files
|
|
336
|
+
|
|
337
|
+
Returns
|
|
338
|
+
-------
|
|
339
|
+
None
|
|
340
|
+
"""
|
|
341
|
+
...
|
|
342
|
+
|
|
343
|
+
def current_font_directories() -> list[str]:
|
|
344
|
+
"""
|
|
345
|
+
Return the currently-registered font directories.
|
|
346
|
+
|
|
347
|
+
The registry is process-global state, not a ``configure()`` field
|
|
348
|
+
and not env-var-controlled. It starts empty and is mutated only by:
|
|
349
|
+
|
|
350
|
+
- ``register_font_directory(path)``: append one path.
|
|
351
|
+
- ``set_font_directories(paths)``: replace the full list.
|
|
352
|
+
|
|
353
|
+
Returns
|
|
354
|
+
-------
|
|
355
|
+
list[str]
|
|
356
|
+
Absolute paths to the registered font directories.
|
|
357
|
+
"""
|
|
358
|
+
...
|
|
359
|
+
|
|
360
|
+
def google_fonts_cache_dir() -> str | None:
|
|
361
|
+
"""
|
|
362
|
+
Return the path of the on-disk Google Fonts cache directory.
|
|
363
|
+
|
|
364
|
+
Resolved once per process from the environment:
|
|
365
|
+
|
|
366
|
+
1. ``VL_CONVERT_FONT_CACHE_DIR=none``: ``None`` (caching disabled,
|
|
367
|
+
fonts always fetched fresh).
|
|
368
|
+
2. ``VL_CONVERT_FONT_CACHE_DIR=/some/path``: that path.
|
|
369
|
+
3. Unset: the OS cache directory joined with ``vl-convert/google-fonts``
|
|
370
|
+
(e.g. ``~/Library/Caches/vl-convert/google-fonts`` on macOS).
|
|
371
|
+
|
|
372
|
+
The value is fixed for the lifetime of the process; there is no
|
|
373
|
+
runtime setter.
|
|
374
|
+
|
|
375
|
+
Returns
|
|
376
|
+
-------
|
|
377
|
+
Optional[str]
|
|
378
|
+
Absolute path to the Google Fonts cache directory, or ``None``
|
|
379
|
+
if caching is disabled.
|
|
380
|
+
"""
|
|
381
|
+
...
|
|
382
|
+
|
|
383
|
+
def google_fonts_cache_size_mb() -> int:
|
|
384
|
+
"""
|
|
385
|
+
Return the active Google Fonts on-disk LRU cache cap (in MB).
|
|
386
|
+
|
|
387
|
+
Process-global state. Always returns the resolved cap: at process start
|
|
388
|
+
this is the library default (512 MB); subsequent
|
|
389
|
+
``set_google_fonts_cache_size_mb`` calls overwrite it.
|
|
390
|
+
|
|
391
|
+
Returns
|
|
392
|
+
-------
|
|
393
|
+
int
|
|
394
|
+
Active cap in megabytes (always positive).
|
|
395
|
+
"""
|
|
396
|
+
...
|
|
397
|
+
|
|
398
|
+
def set_google_fonts_cache_size_mb(max_size_mb: int | None) -> None:
|
|
399
|
+
"""
|
|
400
|
+
Set the Google Fonts on-disk LRU cache cap (in MB).
|
|
401
|
+
|
|
402
|
+
``None`` resets to the library default. Cached fonts over the new
|
|
403
|
+
limit are evicted immediately. Process-global; affects every
|
|
404
|
+
converter in the process.
|
|
405
|
+
|
|
406
|
+
Parameters
|
|
407
|
+
----------
|
|
408
|
+
max_size_mb
|
|
409
|
+
New cap in megabytes; must be >= 1 or ``None``. Passing ``0``
|
|
410
|
+
raises ``ValueError``.
|
|
411
|
+
"""
|
|
412
|
+
...
|
|
413
|
+
|
|
414
|
+
def configure(
|
|
415
|
+
*,
|
|
416
|
+
num_workers: int | None = None,
|
|
417
|
+
base_url: str | bool | None = None,
|
|
418
|
+
allowed_base_urls: list[str] | None = None,
|
|
419
|
+
auto_google_fonts: bool | None = None,
|
|
420
|
+
embed_local_fonts: bool | None = None,
|
|
421
|
+
subset_fonts: bool | None = None,
|
|
422
|
+
missing_fonts: Literal["fallback", "warn", "error"] | None = None,
|
|
423
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
424
|
+
google_font_variant_threshold: int | None = None,
|
|
425
|
+
max_v8_heap_size_mb: int | None = None,
|
|
426
|
+
max_v8_execution_time_secs: int | None = None,
|
|
427
|
+
gc_after_conversion: bool | None = None,
|
|
428
|
+
vega_plugins: list[str] | None = None,
|
|
429
|
+
plugin_import_domains: list[str] | None = None,
|
|
430
|
+
allow_per_request_plugins: bool | None = None,
|
|
431
|
+
max_ephemeral_workers: int | None = None,
|
|
432
|
+
allow_google_fonts: bool | None = None,
|
|
433
|
+
per_request_plugin_import_domains: list[str] | None = None,
|
|
434
|
+
default_theme: str | None = None,
|
|
435
|
+
default_format_locale: str | dict[str, Any] | None = None,
|
|
436
|
+
default_time_format_locale: str | dict[str, Any] | None = None,
|
|
437
|
+
themes: dict[str, dict[str, Any]] | None = None,
|
|
438
|
+
) -> None:
|
|
439
|
+
"""
|
|
440
|
+
Configure converter worker/access settings used by subsequent conversions.
|
|
441
|
+
|
|
442
|
+
Parameters
|
|
443
|
+
----------
|
|
444
|
+
num_workers
|
|
445
|
+
Worker count (must be >= 1). ``None`` resets to the library default (1).
|
|
446
|
+
Passing ``0`` raises ``ValueError``.
|
|
447
|
+
base_url
|
|
448
|
+
Base URL for resolving relative data paths in Vega specs.
|
|
449
|
+
``None`` or ``True`` resets to the default (vega-datasets CDN).
|
|
450
|
+
``False`` disables relative path resolution.
|
|
451
|
+
A string sets a custom base URL or filesystem path.
|
|
452
|
+
allowed_base_urls
|
|
453
|
+
CSP-style allowlist for data access (HTTP URLs, filesystem paths).
|
|
454
|
+
Examples: ``"https:"`` (scheme), ``"https://example.com/"`` (prefix),
|
|
455
|
+
``"/data/"`` (filesystem), ``"*"`` (everything). ``None`` resets to
|
|
456
|
+
the library default (``["http:", "https:"]``); ``[]`` blocks all
|
|
457
|
+
network data.
|
|
458
|
+
auto_google_fonts
|
|
459
|
+
Automatically download missing fonts from Google Fonts.
|
|
460
|
+
``None`` resets to the library default (``False``).
|
|
461
|
+
embed_local_fonts
|
|
462
|
+
Embed locally available fonts as base64-encoded data URIs in SVG and HTML
|
|
463
|
+
output. Does not apply to PDF/PNG/JPEG (which always embed fonts via fontdb).
|
|
464
|
+
``None`` resets to the library default (``False``).
|
|
465
|
+
subset_fonts
|
|
466
|
+
Subset fonts to only the characters used in the chart. Applies to SVG
|
|
467
|
+
and HTML output. ``None`` resets to the library default (``True``).
|
|
468
|
+
missing_fonts
|
|
469
|
+
Missing-font behavior: ``"fallback"`` (silent), ``"warn"``, or ``"error"``.
|
|
470
|
+
``None`` resets to the library default (``"fallback"``).
|
|
471
|
+
google_fonts
|
|
472
|
+
Google Fonts to register for all subsequent conversions. Each entry is
|
|
473
|
+
a family-name string or a dict with ``"family"`` (required) and
|
|
474
|
+
optionally ``"variants"`` (list of ``(weight, style)`` tuples). Fonts
|
|
475
|
+
are downloaded and registered on each conversion call.
|
|
476
|
+
|
|
477
|
+
**Replace semantics.** Each call to ``configure(google_fonts=[...])``
|
|
478
|
+
**replaces** the full configured list. ``None`` (or ``[]``) resets to
|
|
479
|
+
the library default (empty list).
|
|
480
|
+
google_font_variant_threshold
|
|
481
|
+
Stop admitting additional Google Font families after this many variants
|
|
482
|
+
have resolved. A single family may cross the threshold. Must be >= 1 if
|
|
483
|
+
provided. ``None`` resets to the library default (no threshold). Passing
|
|
484
|
+
``0`` raises ``ValueError``.
|
|
485
|
+
max_v8_heap_size_mb
|
|
486
|
+
Maximum V8 heap size per worker in megabytes. Must be >= 1 if provided.
|
|
487
|
+
``None`` resets to the library default (no cap). Passing ``0`` raises
|
|
488
|
+
``ValueError``.
|
|
489
|
+
max_v8_execution_time_secs
|
|
490
|
+
Maximum V8 execution time in seconds. Must be >= 1 if provided. When
|
|
491
|
+
exceeded, V8 execution is terminated and an error is returned.
|
|
492
|
+
``None`` resets to the library default (no cap). Passing ``0`` raises
|
|
493
|
+
``ValueError``.
|
|
494
|
+
gc_after_conversion
|
|
495
|
+
Whether to run V8 garbage collection after each conversion to release
|
|
496
|
+
memory back to the OS. ``None`` resets to the library default (``False``).
|
|
497
|
+
vega_plugins
|
|
498
|
+
List of Vega plugins to load. Each entry is a file path (``.js``/``.mjs``),
|
|
499
|
+
URL (``https://...``), or inline ESM string. Plugins must be single-entry
|
|
500
|
+
ESM modules with a default export function accepting a ``vega`` object.
|
|
501
|
+
Multi-file plugins should be pre-bundled with esbuild or Rollup.
|
|
502
|
+
URL plugins auto-allow their domain for imports. ``None`` (or ``[]``)
|
|
503
|
+
resets to the library default (empty list).
|
|
504
|
+
plugin_import_domains
|
|
505
|
+
Domain patterns allowed for HTTP imports inside config-level plugins.
|
|
506
|
+
Use ``["*"]`` for any domain, or ``["esm.sh", "*.jsdelivr.net"]``.
|
|
507
|
+
``None`` (or ``[]``) resets to the library default (empty list;
|
|
508
|
+
HTTP imports disabled).
|
|
509
|
+
allow_per_request_plugins
|
|
510
|
+
Whether to accept per-request plugins via the ``vega_plugin`` parameter
|
|
511
|
+
on conversion functions. ``None`` resets to the library default (``False``).
|
|
512
|
+
max_ephemeral_workers
|
|
513
|
+
Maximum concurrent ephemeral V8 isolates for per-request plugins. Must
|
|
514
|
+
be >= 1 if provided. ``None`` resets to the library default (2).
|
|
515
|
+
Passing ``0`` raises ``ValueError``.
|
|
516
|
+
allow_google_fonts
|
|
517
|
+
Whether to accept per-request ``google_fonts`` / ``auto_google_fonts``
|
|
518
|
+
overrides on conversion calls. ``None`` resets to the library default
|
|
519
|
+
(``False``).
|
|
520
|
+
per_request_plugin_import_domains
|
|
521
|
+
Domain patterns allowed for HTTP imports inside per-request plugins.
|
|
522
|
+
Separate from ``plugin_import_domains``. ``None`` (or ``[]``) resets
|
|
523
|
+
to the library default (empty list; HTTP imports disabled).
|
|
524
|
+
default_theme
|
|
525
|
+
Default named theme (e.g. ``"dark"``) applied to all Vega-Lite conversions.
|
|
526
|
+
Per-request ``theme`` overrides this if set. ``None`` resets to the
|
|
527
|
+
library default (no theme).
|
|
528
|
+
default_format_locale
|
|
529
|
+
Default d3-format locale name (e.g. ``"fr-FR"``) applied to all conversions.
|
|
530
|
+
Per-request ``format_locale`` overrides this if set. ``None`` resets
|
|
531
|
+
to the library default (no locale).
|
|
532
|
+
default_time_format_locale
|
|
533
|
+
Default d3-time-format locale name (e.g. ``"fr-FR"``) applied to all conversions.
|
|
534
|
+
Per-request ``time_format_locale`` overrides this if set. ``None``
|
|
535
|
+
resets to the library default (no locale).
|
|
536
|
+
themes
|
|
537
|
+
Custom named themes mapping names to Vega config objects.
|
|
538
|
+
Registered alongside built-in vega-themes. Custom themes take
|
|
539
|
+
priority over built-in themes if names collide. ``None`` (or ``{}``)
|
|
540
|
+
resets to the library default (empty map).
|
|
541
|
+
"""
|
|
542
|
+
...
|
|
543
|
+
|
|
544
|
+
def load_config(path: str | None = None) -> None:
|
|
545
|
+
"""
|
|
546
|
+
Load converter configuration from a JSONC file, replacing the active config.
|
|
547
|
+
|
|
548
|
+
Unlike ``configure()``, which patches individual fields, ``load_config()``
|
|
549
|
+
resets all settings to their defaults and then applies the file. Call
|
|
550
|
+
``configure()`` after ``load_config()`` to override specific fields in code.
|
|
551
|
+
|
|
552
|
+
Parameters
|
|
553
|
+
----------
|
|
554
|
+
path
|
|
555
|
+
Path to the JSONC config file. When omitted, loads from the standard
|
|
556
|
+
location returned by ``get_config_path()``. If that file does not
|
|
557
|
+
exist, resets to built-in defaults.
|
|
558
|
+
|
|
559
|
+
Raises
|
|
560
|
+
------
|
|
561
|
+
ValueError
|
|
562
|
+
If ``path`` is provided but the file cannot be read or parsed.
|
|
563
|
+
"""
|
|
564
|
+
...
|
|
565
|
+
|
|
566
|
+
def get_config_path() -> str:
|
|
567
|
+
"""
|
|
568
|
+
Return the platform-standard path for the vl-convert JSONC config file.
|
|
569
|
+
|
|
570
|
+
This is the path ``load_config()`` reads when called without arguments,
|
|
571
|
+
and the same path printed by ``vl-convert config-path`` on the CLI.
|
|
572
|
+
The file may not exist.
|
|
573
|
+
|
|
574
|
+
Returns
|
|
575
|
+
-------
|
|
576
|
+
str
|
|
577
|
+
Absolute path to the standard JSONC config file.
|
|
578
|
+
"""
|
|
579
|
+
...
|
|
580
|
+
|
|
581
|
+
def get_config() -> ConverterConfig:
|
|
582
|
+
"""
|
|
583
|
+
Get the active converter worker/access configuration.
|
|
584
|
+
|
|
585
|
+
Returns
|
|
586
|
+
-------
|
|
587
|
+
Converter configuration dictionary.
|
|
588
|
+
"""
|
|
589
|
+
...
|
|
590
|
+
|
|
591
|
+
def warm_up_workers() -> None:
|
|
592
|
+
"""
|
|
593
|
+
Eagerly start converter workers for the current converter configuration.
|
|
594
|
+
|
|
595
|
+
Pre-initializes worker runtimes before conversion requests are submitted.
|
|
596
|
+
"""
|
|
597
|
+
...
|
|
598
|
+
|
|
599
|
+
class WorkerMemoryUsage(TypedDict):
|
|
600
|
+
worker_index: int
|
|
601
|
+
used_heap_size: int
|
|
602
|
+
total_heap_size: int
|
|
603
|
+
heap_size_limit: int
|
|
604
|
+
external_memory: int
|
|
605
|
+
|
|
606
|
+
def get_worker_memory_usage() -> list[WorkerMemoryUsage]:
|
|
607
|
+
"""
|
|
608
|
+
Get V8 memory usage for each worker in the converter pool.
|
|
609
|
+
|
|
610
|
+
Returns
|
|
611
|
+
-------
|
|
612
|
+
list[WorkerMemoryUsage]
|
|
613
|
+
List of dicts with ``worker_index``, ``used_heap_size``,
|
|
614
|
+
``total_heap_size``, ``heap_size_limit``, and ``external_memory``
|
|
615
|
+
(all sizes in bytes).
|
|
616
|
+
"""
|
|
617
|
+
...
|
|
618
|
+
|
|
619
|
+
def svg_to_jpeg(
|
|
620
|
+
svg: str, *, scale: float | None = None, quality: int | None = None
|
|
621
|
+
) -> bytes:
|
|
622
|
+
"""
|
|
623
|
+
Convert an SVG image string to JPEG image data.
|
|
624
|
+
|
|
625
|
+
Parameters
|
|
626
|
+
----------
|
|
627
|
+
svg
|
|
628
|
+
SVG image string
|
|
629
|
+
scale
|
|
630
|
+
Image scale factor (default 1.0)
|
|
631
|
+
quality
|
|
632
|
+
JPEG Quality between 0 (worst) and 100 (best). Default 90
|
|
633
|
+
|
|
634
|
+
Returns
|
|
635
|
+
-------
|
|
636
|
+
JPEG image data.
|
|
637
|
+
"""
|
|
638
|
+
...
|
|
639
|
+
|
|
640
|
+
def svg_to_pdf(svg: str) -> bytes:
|
|
641
|
+
"""
|
|
642
|
+
Convert an SVG image string to PDF document data.
|
|
643
|
+
|
|
644
|
+
Parameters
|
|
645
|
+
----------
|
|
646
|
+
svg
|
|
647
|
+
SVG image string
|
|
648
|
+
|
|
649
|
+
Returns
|
|
650
|
+
-------
|
|
651
|
+
PDF document data.
|
|
652
|
+
"""
|
|
653
|
+
...
|
|
654
|
+
|
|
655
|
+
def svg_to_png(
|
|
656
|
+
svg: str, *, scale: float | None = None, ppi: float | None = None
|
|
657
|
+
) -> bytes:
|
|
658
|
+
"""
|
|
659
|
+
Convert an SVG image string to PNG image data.
|
|
660
|
+
|
|
661
|
+
Parameters
|
|
662
|
+
----------
|
|
663
|
+
svg
|
|
664
|
+
SVG image string
|
|
665
|
+
scale
|
|
666
|
+
Image scale factor (default 1.0)
|
|
667
|
+
ppi
|
|
668
|
+
Pixels per inch (default 72)
|
|
669
|
+
|
|
670
|
+
Returns
|
|
671
|
+
-------
|
|
672
|
+
PNG image data.
|
|
673
|
+
"""
|
|
674
|
+
...
|
|
675
|
+
|
|
676
|
+
def vega_to_html(
|
|
677
|
+
vg_spec: VlSpec,
|
|
678
|
+
*,
|
|
679
|
+
bundle: bool | None = None,
|
|
680
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
681
|
+
format_locale: FormatLocale | None = None,
|
|
682
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
683
|
+
renderer: Renderer | None = None,
|
|
684
|
+
vega_plugin: str | None = None,
|
|
685
|
+
config: str | dict[str, Any] | None = None,
|
|
686
|
+
background: str | None = None,
|
|
687
|
+
width: float | None = None,
|
|
688
|
+
height: float | None = None,
|
|
689
|
+
) -> str:
|
|
690
|
+
"""
|
|
691
|
+
Convert a Vega spec to an HTML document, optionally bundling dependencies.
|
|
692
|
+
|
|
693
|
+
Parameters
|
|
694
|
+
----------
|
|
695
|
+
vg_spec
|
|
696
|
+
Vega JSON specification string or dict
|
|
697
|
+
bundle
|
|
698
|
+
If True, bundle all dependencies in HTML file.
|
|
699
|
+
If False (default), HTML file will load dependencies from only CDN
|
|
700
|
+
google_fonts
|
|
701
|
+
Google Fonts to use for this conversion. Each entry is a family name
|
|
702
|
+
string or a dict with ``"family"`` and optional ``"variants"``.
|
|
703
|
+
format_locale
|
|
704
|
+
d3-format locale name or dictionary
|
|
705
|
+
time_format_locale
|
|
706
|
+
d3-time-format locale name or dictionary
|
|
707
|
+
renderer
|
|
708
|
+
Vega renderer. One of 'svg' (default), 'canvas',
|
|
709
|
+
or 'hybrid' (where text is svg and other marks are canvas)
|
|
710
|
+
vega_plugin
|
|
711
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
712
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
713
|
+
config
|
|
714
|
+
Vega config object merged via ``vega.mergeConfig(spec.config, config)``.
|
|
715
|
+
background
|
|
716
|
+
Override the spec's background color.
|
|
717
|
+
width
|
|
718
|
+
Override the spec's width.
|
|
719
|
+
height
|
|
720
|
+
Override the spec's height.
|
|
721
|
+
Returns
|
|
722
|
+
-------
|
|
723
|
+
HTML document.
|
|
724
|
+
"""
|
|
725
|
+
...
|
|
726
|
+
|
|
727
|
+
def vega_to_jpeg(
|
|
728
|
+
vg_spec: VlSpec,
|
|
729
|
+
*,
|
|
730
|
+
scale: float | None = None,
|
|
731
|
+
quality: int | None = None,
|
|
732
|
+
format_locale: FormatLocale | None = None,
|
|
733
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
734
|
+
vega_plugin: str | None = None,
|
|
735
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
736
|
+
config: str | dict[str, Any] | None = None,
|
|
737
|
+
background: str | None = None,
|
|
738
|
+
width: float | None = None,
|
|
739
|
+
height: float | None = None,
|
|
740
|
+
) -> bytes:
|
|
741
|
+
"""
|
|
742
|
+
Convert a Vega spec to JPEG image data.
|
|
743
|
+
|
|
744
|
+
Parameters
|
|
745
|
+
----------
|
|
746
|
+
vg_spec
|
|
747
|
+
Vega JSON specification string or dict
|
|
748
|
+
scale
|
|
749
|
+
Image scale factor (default 1.0)
|
|
750
|
+
quality
|
|
751
|
+
JPEG Quality between 0 (worst) and 100 (best). Default 90
|
|
752
|
+
format_locale
|
|
753
|
+
d3-format locale name or dictionary
|
|
754
|
+
time_format_locale
|
|
755
|
+
d3-time-format locale name or dictionary
|
|
756
|
+
vega_plugin
|
|
757
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
758
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
759
|
+
google_fonts
|
|
760
|
+
Google Fonts to register for this conversion.
|
|
761
|
+
config
|
|
762
|
+
Vega config object merged via ``vega.mergeConfig(spec.config, config)``.
|
|
763
|
+
background
|
|
764
|
+
Override the spec's background color.
|
|
765
|
+
width
|
|
766
|
+
Override the spec's width.
|
|
767
|
+
height
|
|
768
|
+
Override the spec's height.
|
|
769
|
+
Returns
|
|
770
|
+
-------
|
|
771
|
+
JPEG image data.
|
|
772
|
+
"""
|
|
773
|
+
...
|
|
774
|
+
|
|
775
|
+
def vega_to_pdf(
|
|
776
|
+
vg_spec: VlSpec,
|
|
777
|
+
*,
|
|
778
|
+
format_locale: FormatLocale | None = None,
|
|
779
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
780
|
+
vega_plugin: str | None = None,
|
|
781
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
782
|
+
config: str | dict[str, Any] | None = None,
|
|
783
|
+
background: str | None = None,
|
|
784
|
+
width: float | None = None,
|
|
785
|
+
height: float | None = None,
|
|
786
|
+
) -> bytes:
|
|
787
|
+
"""
|
|
788
|
+
Convert a Vega spec to PDF format.
|
|
789
|
+
|
|
790
|
+
Parameters
|
|
791
|
+
----------
|
|
792
|
+
vg_spec
|
|
793
|
+
Vega JSON specification string or dict
|
|
794
|
+
format_locale
|
|
795
|
+
d3-format locale name or dictionary
|
|
796
|
+
time_format_locale
|
|
797
|
+
d3-time-format locale name or dictionary
|
|
798
|
+
vega_plugin
|
|
799
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
800
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
801
|
+
google_fonts
|
|
802
|
+
Google Fonts to register for this conversion.
|
|
803
|
+
config
|
|
804
|
+
Vega config object merged via ``vega.mergeConfig(spec.config, config)``.
|
|
805
|
+
background
|
|
806
|
+
Override the spec's background color.
|
|
807
|
+
width
|
|
808
|
+
Override the spec's width.
|
|
809
|
+
height
|
|
810
|
+
Override the spec's height.
|
|
811
|
+
Returns
|
|
812
|
+
-------
|
|
813
|
+
PDF file bytes.
|
|
814
|
+
"""
|
|
815
|
+
...
|
|
816
|
+
|
|
817
|
+
def vega_to_png(
|
|
818
|
+
vg_spec: VlSpec,
|
|
819
|
+
*,
|
|
820
|
+
scale: float | None = None,
|
|
821
|
+
ppi: float | None = None,
|
|
822
|
+
format_locale: FormatLocale | None = None,
|
|
823
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
824
|
+
vega_plugin: str | None = None,
|
|
825
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
826
|
+
config: str | dict[str, Any] | None = None,
|
|
827
|
+
background: str | None = None,
|
|
828
|
+
width: float | None = None,
|
|
829
|
+
height: float | None = None,
|
|
830
|
+
) -> bytes:
|
|
831
|
+
"""
|
|
832
|
+
Convert a Vega spec to PNG image data.
|
|
833
|
+
|
|
834
|
+
Parameters
|
|
835
|
+
----------
|
|
836
|
+
vg_spec
|
|
837
|
+
Vega JSON specification string or dict
|
|
838
|
+
scale
|
|
839
|
+
Image scale factor (default 1.0)
|
|
840
|
+
ppi
|
|
841
|
+
Pixels per inch (default 72)
|
|
842
|
+
format_locale
|
|
843
|
+
d3-format locale name or dictionary
|
|
844
|
+
time_format_locale
|
|
845
|
+
d3-time-format locale name or dictionary
|
|
846
|
+
vega_plugin
|
|
847
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
848
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
849
|
+
google_fonts
|
|
850
|
+
Google Fonts to register for this conversion.
|
|
851
|
+
config
|
|
852
|
+
Vega config object merged via ``vega.mergeConfig(spec.config, config)``.
|
|
853
|
+
background
|
|
854
|
+
Override the spec's background color.
|
|
855
|
+
width
|
|
856
|
+
Override the spec's width.
|
|
857
|
+
height
|
|
858
|
+
Override the spec's height.
|
|
859
|
+
Returns
|
|
860
|
+
-------
|
|
861
|
+
PNG image data.
|
|
862
|
+
"""
|
|
863
|
+
...
|
|
864
|
+
|
|
865
|
+
def vega_to_scenegraph(
|
|
866
|
+
vg_spec: VlSpec,
|
|
867
|
+
*,
|
|
868
|
+
format_locale: FormatLocale | None = None,
|
|
869
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
870
|
+
format: Literal["dict", "msgpack"] = "dict",
|
|
871
|
+
vega_plugin: str | None = None,
|
|
872
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
873
|
+
config: str | dict[str, Any] | None = None,
|
|
874
|
+
background: str | None = None,
|
|
875
|
+
width: float | None = None,
|
|
876
|
+
height: float | None = None,
|
|
877
|
+
) -> dict[str, Any] | bytes:
|
|
878
|
+
"""
|
|
879
|
+
Convert a Vega spec to a Vega Scenegraph.
|
|
880
|
+
|
|
881
|
+
Parameters
|
|
882
|
+
----------
|
|
883
|
+
vg_spec
|
|
884
|
+
Vega JSON specification string or dict
|
|
885
|
+
format_locale
|
|
886
|
+
d3-format locale name or dictionary
|
|
887
|
+
time_format_locale
|
|
888
|
+
d3-time-format locale name or dictionary
|
|
889
|
+
format
|
|
890
|
+
Output format: "dict" returns a Python dictionary (default),
|
|
891
|
+
"msgpack" returns raw MessagePack bytes
|
|
892
|
+
vega_plugin
|
|
893
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
894
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
895
|
+
google_fonts
|
|
896
|
+
Google Fonts to register for this conversion.
|
|
897
|
+
config
|
|
898
|
+
Vega config object merged via ``vega.mergeConfig(spec.config, config)``.
|
|
899
|
+
background
|
|
900
|
+
Override the spec's background color.
|
|
901
|
+
width
|
|
902
|
+
Override the spec's width.
|
|
903
|
+
height
|
|
904
|
+
Override the spec's height.
|
|
905
|
+
Returns
|
|
906
|
+
-------
|
|
907
|
+
scenegraph as dict (format="dict") or msgpack bytes (format="msgpack")
|
|
908
|
+
"""
|
|
909
|
+
...
|
|
910
|
+
|
|
911
|
+
def vega_to_svg(
|
|
912
|
+
vg_spec: VlSpec,
|
|
913
|
+
*,
|
|
914
|
+
format_locale: FormatLocale | None = None,
|
|
915
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
916
|
+
vega_plugin: str | None = None,
|
|
917
|
+
bundle: bool | None = None,
|
|
918
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
919
|
+
config: str | dict[str, Any] | None = None,
|
|
920
|
+
background: str | None = None,
|
|
921
|
+
width: float | None = None,
|
|
922
|
+
height: float | None = None,
|
|
923
|
+
) -> str:
|
|
924
|
+
"""
|
|
925
|
+
Convert a Vega spec to an SVG image string.
|
|
926
|
+
|
|
927
|
+
Parameters
|
|
928
|
+
----------
|
|
929
|
+
vg_spec
|
|
930
|
+
Vega JSON specification string or dict
|
|
931
|
+
format_locale
|
|
932
|
+
d3-format locale name or dictionary
|
|
933
|
+
time_format_locale
|
|
934
|
+
d3-time-format locale name or dictionary
|
|
935
|
+
vega_plugin
|
|
936
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
937
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
938
|
+
bundle
|
|
939
|
+
If True, embed fonts and images as self-contained data URIs.
|
|
940
|
+
If False (default), use ``@import`` references for Google Fonts.
|
|
941
|
+
google_fonts
|
|
942
|
+
Google Fonts to register for this conversion. Each entry is
|
|
943
|
+
a family-name string or a dict with ``"family"`` (required) and
|
|
944
|
+
optionally ``"variants"``.
|
|
945
|
+
config
|
|
946
|
+
Vega config object merged via ``vega.mergeConfig(spec.config, config)``.
|
|
947
|
+
background
|
|
948
|
+
Override the spec's background color.
|
|
949
|
+
width
|
|
950
|
+
Override the spec's width.
|
|
951
|
+
height
|
|
952
|
+
Override the spec's height.
|
|
953
|
+
Returns
|
|
954
|
+
-------
|
|
955
|
+
SVG image string.
|
|
956
|
+
"""
|
|
957
|
+
...
|
|
958
|
+
|
|
959
|
+
def vega_to_url(vg_spec: VlSpec, *, fullscreen: bool | None = None) -> str:
|
|
960
|
+
"""
|
|
961
|
+
Convert a Vega spec to a URL that opens the chart in the Vega editor.
|
|
962
|
+
|
|
963
|
+
Parameters
|
|
964
|
+
----------
|
|
965
|
+
vg_spec
|
|
966
|
+
Vega JSON specification string or dict
|
|
967
|
+
fullscreen
|
|
968
|
+
Whether to open the chart in full screen in the editor
|
|
969
|
+
|
|
970
|
+
Returns
|
|
971
|
+
-------
|
|
972
|
+
URL string.
|
|
973
|
+
"""
|
|
974
|
+
...
|
|
975
|
+
|
|
976
|
+
def vegalite_fonts(
|
|
977
|
+
vl_spec: VlSpec,
|
|
978
|
+
vl_version: str | None = None,
|
|
979
|
+
config: dict[str, Any] | None = None,
|
|
980
|
+
theme: VegaThemes | None = None,
|
|
981
|
+
auto_google_fonts: bool | None = None,
|
|
982
|
+
include_font_face: bool = False,
|
|
983
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
984
|
+
format_locale: FormatLocale | None = None,
|
|
985
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
986
|
+
) -> list[FontInfo]:
|
|
987
|
+
"""
|
|
988
|
+
Return structured font metadata for a rendered Vega-Lite spec.
|
|
989
|
+
|
|
990
|
+
Parameters
|
|
991
|
+
----------
|
|
992
|
+
vl_spec
|
|
993
|
+
Vega-Lite JSON specification string or dict
|
|
994
|
+
vl_version
|
|
995
|
+
Vega-Lite library version string (e.g. 'v5.15')
|
|
996
|
+
(default to latest)
|
|
997
|
+
config
|
|
998
|
+
Chart configuration object to apply during conversion
|
|
999
|
+
theme
|
|
1000
|
+
Named theme (e.g. "dark") to apply during conversion
|
|
1001
|
+
auto_google_fonts
|
|
1002
|
+
Override auto-download from Google Fonts
|
|
1003
|
+
(default: use converter config)
|
|
1004
|
+
include_font_face
|
|
1005
|
+
Whether to run the font subsetting pipeline and populate
|
|
1006
|
+
the ``font_face`` field on each variant (default False)
|
|
1007
|
+
google_fonts
|
|
1008
|
+
Google Fonts to use for this conversion. Each entry is a family name
|
|
1009
|
+
string or a dict with ``"family"`` and optional ``"variants"``.
|
|
1010
|
+
format_locale
|
|
1011
|
+
d3-format locale name or dictionary
|
|
1012
|
+
time_format_locale
|
|
1013
|
+
d3-time-format locale name or dictionary
|
|
1014
|
+
|
|
1015
|
+
Returns
|
|
1016
|
+
-------
|
|
1017
|
+
Structured font metadata for each font used by the chart.
|
|
1018
|
+
"""
|
|
1019
|
+
...
|
|
1020
|
+
|
|
1021
|
+
def vega_fonts(
|
|
1022
|
+
vg_spec: VlSpec,
|
|
1023
|
+
auto_google_fonts: bool | None = None,
|
|
1024
|
+
include_font_face: bool = False,
|
|
1025
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1026
|
+
format_locale: FormatLocale | None = None,
|
|
1027
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1028
|
+
) -> list[FontInfo]:
|
|
1029
|
+
"""
|
|
1030
|
+
Return structured font metadata for a rendered Vega spec.
|
|
1031
|
+
|
|
1032
|
+
Parameters
|
|
1033
|
+
----------
|
|
1034
|
+
vg_spec
|
|
1035
|
+
Vega JSON specification string or dict
|
|
1036
|
+
auto_google_fonts
|
|
1037
|
+
Override auto-download from Google Fonts
|
|
1038
|
+
(default: use converter config)
|
|
1039
|
+
include_font_face
|
|
1040
|
+
Whether to run the font subsetting pipeline and populate
|
|
1041
|
+
the ``font_face`` field on each variant (default False)
|
|
1042
|
+
google_fonts
|
|
1043
|
+
Google Fonts to use for this conversion. Each entry is a family name
|
|
1044
|
+
string or a dict with ``"family"`` and optional ``"variants"``.
|
|
1045
|
+
format_locale
|
|
1046
|
+
d3-format locale name or dictionary
|
|
1047
|
+
time_format_locale
|
|
1048
|
+
d3-time-format locale name or dictionary
|
|
1049
|
+
|
|
1050
|
+
Returns
|
|
1051
|
+
-------
|
|
1052
|
+
Structured font metadata for each font used by the chart.
|
|
1053
|
+
"""
|
|
1054
|
+
...
|
|
1055
|
+
|
|
1056
|
+
def vegalite_to_html(
|
|
1057
|
+
vl_spec: VlSpec,
|
|
1058
|
+
*,
|
|
1059
|
+
vl_version: str | None = None,
|
|
1060
|
+
bundle: bool | None = None,
|
|
1061
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1062
|
+
config: dict[str, Any] | None = None,
|
|
1063
|
+
theme: VegaThemes | None = None,
|
|
1064
|
+
format_locale: FormatLocale | None = None,
|
|
1065
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1066
|
+
renderer: Renderer | None = None,
|
|
1067
|
+
vega_plugin: str | None = None,
|
|
1068
|
+
background: str | None = None,
|
|
1069
|
+
width: float | None = None,
|
|
1070
|
+
height: float | None = None,
|
|
1071
|
+
) -> str:
|
|
1072
|
+
"""
|
|
1073
|
+
Convert a Vega-Lite spec to an HTML document, optionally bundling dependencies.
|
|
1074
|
+
|
|
1075
|
+
Parameters
|
|
1076
|
+
----------
|
|
1077
|
+
vl_spec
|
|
1078
|
+
Vega-Lite JSON specification string or dict
|
|
1079
|
+
vl_version
|
|
1080
|
+
Vega-Lite library version string (e.g. 'v5.15')
|
|
1081
|
+
(default to latest)
|
|
1082
|
+
bundle
|
|
1083
|
+
If True, bundle all dependencies in HTML file.
|
|
1084
|
+
If False (default), HTML file will load dependencies from only CDN
|
|
1085
|
+
google_fonts
|
|
1086
|
+
Google Fonts to use for this conversion. Each entry is a family name
|
|
1087
|
+
string or a dict with ``"family"`` and optional ``"variants"``.
|
|
1088
|
+
config
|
|
1089
|
+
Chart configuration object to apply during conversion
|
|
1090
|
+
theme
|
|
1091
|
+
Named theme (e.g. "dark") to apply during conversion
|
|
1092
|
+
format_locale
|
|
1093
|
+
d3-format locale name or dictionary
|
|
1094
|
+
time_format_locale
|
|
1095
|
+
d3-time-format locale name or dictionary
|
|
1096
|
+
renderer
|
|
1097
|
+
Vega renderer. One of 'svg' (default), 'canvas',
|
|
1098
|
+
or 'hybrid' (where text is svg and other marks are canvas)
|
|
1099
|
+
vega_plugin
|
|
1100
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
1101
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
1102
|
+
background
|
|
1103
|
+
Override the spec's background color.
|
|
1104
|
+
width
|
|
1105
|
+
Override the spec's width.
|
|
1106
|
+
height
|
|
1107
|
+
Override the spec's height.
|
|
1108
|
+
Returns
|
|
1109
|
+
-------
|
|
1110
|
+
HTML document.
|
|
1111
|
+
"""
|
|
1112
|
+
...
|
|
1113
|
+
|
|
1114
|
+
def vegalite_to_jpeg(
|
|
1115
|
+
vl_spec: VlSpec,
|
|
1116
|
+
*,
|
|
1117
|
+
vl_version: str | None = None,
|
|
1118
|
+
scale: float | None = None,
|
|
1119
|
+
quality: int | None = None,
|
|
1120
|
+
config: dict[str, Any] | None = None,
|
|
1121
|
+
theme: VegaThemes | None = None,
|
|
1122
|
+
show_warnings: bool | None = None,
|
|
1123
|
+
format_locale: FormatLocale | None = None,
|
|
1124
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1125
|
+
vega_plugin: str | None = None,
|
|
1126
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1127
|
+
background: str | None = None,
|
|
1128
|
+
width: float | None = None,
|
|
1129
|
+
height: float | None = None,
|
|
1130
|
+
) -> bytes:
|
|
1131
|
+
"""
|
|
1132
|
+
Convert a Vega-Lite spec to JPEG image data using a particular version of the Vega-Lite JavaScript library.
|
|
1133
|
+
|
|
1134
|
+
Parameters
|
|
1135
|
+
----------
|
|
1136
|
+
vl_spec
|
|
1137
|
+
Vega-Lite JSON specification string or dict
|
|
1138
|
+
vl_version
|
|
1139
|
+
Vega-Lite library version string (e.g. 'v5.15')
|
|
1140
|
+
(default to latest)
|
|
1141
|
+
scale
|
|
1142
|
+
Image scale factor (default 1.0)
|
|
1143
|
+
quality
|
|
1144
|
+
JPEG Quality between 0 (worst) and 100 (best). Default 90
|
|
1145
|
+
config
|
|
1146
|
+
Chart configuration object to apply during conversion
|
|
1147
|
+
theme
|
|
1148
|
+
Named theme (e.g. "dark") to apply during conversion
|
|
1149
|
+
show_warnings
|
|
1150
|
+
Whether to print Vega-Lite compilation warnings (default false)
|
|
1151
|
+
format_locale
|
|
1152
|
+
d3-format locale name or dictionary
|
|
1153
|
+
time_format_locale
|
|
1154
|
+
d3-time-format locale name or dictionary
|
|
1155
|
+
vega_plugin
|
|
1156
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
1157
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
1158
|
+
google_fonts
|
|
1159
|
+
Google Fonts to register for this conversion.
|
|
1160
|
+
background
|
|
1161
|
+
Override the spec's background color.
|
|
1162
|
+
width
|
|
1163
|
+
Override the spec's width.
|
|
1164
|
+
height
|
|
1165
|
+
Override the spec's height.
|
|
1166
|
+
Returns
|
|
1167
|
+
-------
|
|
1168
|
+
PDF file bytes.
|
|
1169
|
+
"""
|
|
1170
|
+
...
|
|
1171
|
+
|
|
1172
|
+
def vegalite_to_pdf(
|
|
1173
|
+
vl_spec: VlSpec,
|
|
1174
|
+
*,
|
|
1175
|
+
vl_version: str | None = None,
|
|
1176
|
+
config: dict[str, Any] | None = None,
|
|
1177
|
+
theme: VegaThemes | None = None,
|
|
1178
|
+
format_locale: FormatLocale | None = None,
|
|
1179
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1180
|
+
vega_plugin: str | None = None,
|
|
1181
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1182
|
+
background: str | None = None,
|
|
1183
|
+
width: float | None = None,
|
|
1184
|
+
height: float | None = None,
|
|
1185
|
+
) -> bytes:
|
|
1186
|
+
"""
|
|
1187
|
+
Convert a Vega-Lite spec to PDF image data using a particular version of the Vega-Lite JavaScript library.
|
|
1188
|
+
|
|
1189
|
+
Parameters
|
|
1190
|
+
----------
|
|
1191
|
+
vl_spec
|
|
1192
|
+
Vega-Lite JSON specification string or dict
|
|
1193
|
+
vl_version
|
|
1194
|
+
Vega-Lite library version string (e.g. 'v5.15')
|
|
1195
|
+
(default to latest)
|
|
1196
|
+
config
|
|
1197
|
+
Chart configuration object to apply during conversion
|
|
1198
|
+
theme
|
|
1199
|
+
Named theme (e.g. "dark") to apply during conversion
|
|
1200
|
+
format_locale
|
|
1201
|
+
d3-format locale name or dictionary
|
|
1202
|
+
time_format_locale
|
|
1203
|
+
d3-time-format locale name or dictionary
|
|
1204
|
+
vega_plugin
|
|
1205
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
1206
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
1207
|
+
google_fonts
|
|
1208
|
+
Google Fonts to register for this conversion.
|
|
1209
|
+
background
|
|
1210
|
+
Override the spec's background color.
|
|
1211
|
+
width
|
|
1212
|
+
Override the spec's width.
|
|
1213
|
+
height
|
|
1214
|
+
Override the spec's height.
|
|
1215
|
+
Returns
|
|
1216
|
+
-------
|
|
1217
|
+
PDF image data.
|
|
1218
|
+
"""
|
|
1219
|
+
...
|
|
1220
|
+
|
|
1221
|
+
def vegalite_to_png(
|
|
1222
|
+
vl_spec: VlSpec,
|
|
1223
|
+
*,
|
|
1224
|
+
vl_version: str | None = None,
|
|
1225
|
+
scale: float | None = None,
|
|
1226
|
+
ppi: float | None = None,
|
|
1227
|
+
config: dict[str, Any] | None = None,
|
|
1228
|
+
theme: VegaThemes | None = None,
|
|
1229
|
+
show_warnings: bool | None = None,
|
|
1230
|
+
format_locale: FormatLocale | None = None,
|
|
1231
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1232
|
+
vega_plugin: str | None = None,
|
|
1233
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1234
|
+
background: str | None = None,
|
|
1235
|
+
width: float | None = None,
|
|
1236
|
+
height: float | None = None,
|
|
1237
|
+
) -> bytes:
|
|
1238
|
+
"""
|
|
1239
|
+
Convert a Vega-Lite spec to PNG image data using a particular version of the Vega-Lite JavaScript library.
|
|
1240
|
+
|
|
1241
|
+
Parameters
|
|
1242
|
+
----------
|
|
1243
|
+
vl_spec
|
|
1244
|
+
Vega-Lite JSON specification string or dict
|
|
1245
|
+
vl_version
|
|
1246
|
+
Vega-Lite library version string (e.g. 'v5.15')
|
|
1247
|
+
(default to latest)
|
|
1248
|
+
scale
|
|
1249
|
+
Image scale factor (default 1.0)
|
|
1250
|
+
ppi
|
|
1251
|
+
Pixels per inch (default 72)
|
|
1252
|
+
config
|
|
1253
|
+
Chart configuration object to apply during conversion
|
|
1254
|
+
theme
|
|
1255
|
+
Named theme (e.g. "dark") to apply during conversion
|
|
1256
|
+
show_warnings
|
|
1257
|
+
Whether to print Vega-Lite compilation warnings (default false)
|
|
1258
|
+
format_locale
|
|
1259
|
+
d3-format locale name or dictionary
|
|
1260
|
+
time_format_locale
|
|
1261
|
+
d3-time-format locale name or dictionary
|
|
1262
|
+
vega_plugin
|
|
1263
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
1264
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
1265
|
+
google_fonts
|
|
1266
|
+
Google Fonts to register for this conversion.
|
|
1267
|
+
background
|
|
1268
|
+
Override the spec's background color.
|
|
1269
|
+
width
|
|
1270
|
+
Override the spec's width.
|
|
1271
|
+
height
|
|
1272
|
+
Override the spec's height.
|
|
1273
|
+
Returns
|
|
1274
|
+
-------
|
|
1275
|
+
PNG image data.
|
|
1276
|
+
"""
|
|
1277
|
+
...
|
|
1278
|
+
|
|
1279
|
+
def vegalite_to_scenegraph(
|
|
1280
|
+
vl_spec: VlSpec,
|
|
1281
|
+
*,
|
|
1282
|
+
vl_version: str | None = None,
|
|
1283
|
+
config: dict[str, Any] | None = None,
|
|
1284
|
+
theme: VegaThemes | None = None,
|
|
1285
|
+
show_warnings: bool | None = None,
|
|
1286
|
+
format_locale: FormatLocale | None = None,
|
|
1287
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1288
|
+
format: Literal["dict", "msgpack"] = "dict",
|
|
1289
|
+
vega_plugin: str | None = None,
|
|
1290
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1291
|
+
background: str | None = None,
|
|
1292
|
+
width: float | None = None,
|
|
1293
|
+
height: float | None = None,
|
|
1294
|
+
) -> dict[str, Any] | bytes:
|
|
1295
|
+
"""
|
|
1296
|
+
Convert a Vega-Lite spec to a Vega Scenegraph using a particular version of the Vega-Lite JavaScript library.
|
|
1297
|
+
|
|
1298
|
+
Parameters
|
|
1299
|
+
----------
|
|
1300
|
+
vl_spec
|
|
1301
|
+
Vega-Lite JSON specification string or dict
|
|
1302
|
+
vl_version
|
|
1303
|
+
Vega-Lite library version string (e.g. 'v5.15')
|
|
1304
|
+
(default to latest)
|
|
1305
|
+
config
|
|
1306
|
+
Chart configuration object to apply during conversion
|
|
1307
|
+
theme
|
|
1308
|
+
Named theme (e.g. "dark") to apply during conversion
|
|
1309
|
+
show_warnings
|
|
1310
|
+
Whether to print Vega-Lite compilation warnings (default false)
|
|
1311
|
+
format_locale
|
|
1312
|
+
d3-format locale name or dictionary
|
|
1313
|
+
time_format_locale
|
|
1314
|
+
d3-time-format locale name or dictionary
|
|
1315
|
+
format
|
|
1316
|
+
Output format: "dict" returns a Python dictionary (default),
|
|
1317
|
+
"msgpack" returns raw MessagePack bytes
|
|
1318
|
+
vega_plugin
|
|
1319
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
1320
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
1321
|
+
google_fonts
|
|
1322
|
+
Google Fonts to register for this conversion.
|
|
1323
|
+
background
|
|
1324
|
+
Override the spec's background color.
|
|
1325
|
+
width
|
|
1326
|
+
Override the spec's width.
|
|
1327
|
+
height
|
|
1328
|
+
Override the spec's height.
|
|
1329
|
+
Returns
|
|
1330
|
+
-------
|
|
1331
|
+
scenegraph as dict (format="dict") or msgpack bytes (format="msgpack")
|
|
1332
|
+
"""
|
|
1333
|
+
...
|
|
1334
|
+
|
|
1335
|
+
def vegalite_to_svg(
|
|
1336
|
+
vl_spec: VlSpec,
|
|
1337
|
+
*,
|
|
1338
|
+
vl_version: str | None = None,
|
|
1339
|
+
config: dict[str, Any] | None = None,
|
|
1340
|
+
theme: VegaThemes | None = None,
|
|
1341
|
+
show_warnings: bool | None = None,
|
|
1342
|
+
format_locale: FormatLocale | None = None,
|
|
1343
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1344
|
+
vega_plugin: str | None = None,
|
|
1345
|
+
bundle: bool | None = None,
|
|
1346
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1347
|
+
background: str | None = None,
|
|
1348
|
+
width: float | None = None,
|
|
1349
|
+
height: float | None = None,
|
|
1350
|
+
) -> str:
|
|
1351
|
+
"""
|
|
1352
|
+
Convert a Vega-Lite spec to an SVG image string using a particular version of the Vega-Lite JavaScript library.
|
|
1353
|
+
|
|
1354
|
+
Parameters
|
|
1355
|
+
----------
|
|
1356
|
+
vl_spec
|
|
1357
|
+
Vega-Lite JSON specification string or dict
|
|
1358
|
+
vl_version
|
|
1359
|
+
Vega-Lite library version string (e.g. 'v5.15')
|
|
1360
|
+
(default to latest)
|
|
1361
|
+
config
|
|
1362
|
+
Chart configuration object to apply during conversion
|
|
1363
|
+
theme
|
|
1364
|
+
Named theme (e.g. "dark") to apply during conversion
|
|
1365
|
+
show_warnings
|
|
1366
|
+
Whether to print Vega-Lite compilation warnings (default false)
|
|
1367
|
+
format_locale
|
|
1368
|
+
d3-format locale name or dictionary
|
|
1369
|
+
time_format_locale
|
|
1370
|
+
d3-time-format locale name or dictionary
|
|
1371
|
+
vega_plugin
|
|
1372
|
+
Per-request Vega plugin (inline ESM string or URL).
|
|
1373
|
+
Requires ``allow_per_request_plugins=True`` in ``configure()``.
|
|
1374
|
+
bundle
|
|
1375
|
+
If True, embed fonts and images as self-contained data URIs.
|
|
1376
|
+
If False (default), use ``@import`` references for Google Fonts.
|
|
1377
|
+
google_fonts
|
|
1378
|
+
Google Fonts to register for this conversion.
|
|
1379
|
+
background
|
|
1380
|
+
Override the spec's background color.
|
|
1381
|
+
width
|
|
1382
|
+
Override the spec's width.
|
|
1383
|
+
height
|
|
1384
|
+
Override the spec's height.
|
|
1385
|
+
Returns
|
|
1386
|
+
-------
|
|
1387
|
+
SVG image string.
|
|
1388
|
+
"""
|
|
1389
|
+
...
|
|
1390
|
+
|
|
1391
|
+
def vegalite_to_url(vl_spec: VlSpec, *, fullscreen: bool | None = None) -> str:
|
|
1392
|
+
"""
|
|
1393
|
+
Convert a Vega-Lite spec to a URL that opens the chart in the Vega editor.
|
|
1394
|
+
|
|
1395
|
+
Parameters
|
|
1396
|
+
----------
|
|
1397
|
+
vl_spec
|
|
1398
|
+
Vega-Lite JSON specification string or dict
|
|
1399
|
+
fullscreen
|
|
1400
|
+
Whether to open the chart in full screen in the editor
|
|
1401
|
+
|
|
1402
|
+
Returns
|
|
1403
|
+
-------
|
|
1404
|
+
URL string.
|
|
1405
|
+
"""
|
|
1406
|
+
...
|
|
1407
|
+
|
|
1408
|
+
def vegalite_to_vega(
|
|
1409
|
+
vl_spec: VlSpec,
|
|
1410
|
+
*,
|
|
1411
|
+
vl_version: str | None = None,
|
|
1412
|
+
config: dict[str, Any] | None = None,
|
|
1413
|
+
theme: VegaThemes | None = None,
|
|
1414
|
+
show_warnings: bool | None = None,
|
|
1415
|
+
) -> dict[str, Any]:
|
|
1416
|
+
"""
|
|
1417
|
+
Convert a Vega-Lite spec to a Vega spec using a particular version of the Vega-Lite JavaScript library.
|
|
1418
|
+
|
|
1419
|
+
Parameters
|
|
1420
|
+
----------
|
|
1421
|
+
vl_spec
|
|
1422
|
+
Vega-Lite JSON specification string or dict
|
|
1423
|
+
vl_version
|
|
1424
|
+
Vega-Lite library version string (e.g. 'v5.15')
|
|
1425
|
+
(default to latest)
|
|
1426
|
+
config
|
|
1427
|
+
Chart configuration object to apply during conversion
|
|
1428
|
+
theme
|
|
1429
|
+
Named theme (e.g. "dark") to apply during conversion
|
|
1430
|
+
show_warnings
|
|
1431
|
+
Whether to print Vega-Lite compilation warnings (default false)
|
|
1432
|
+
|
|
1433
|
+
Returns
|
|
1434
|
+
-------
|
|
1435
|
+
Vega JSON specification dict.
|
|
1436
|
+
"""
|
|
1437
|
+
...
|
|
1438
|
+
|
|
1439
|
+
def get_vega_version() -> str:
|
|
1440
|
+
"""
|
|
1441
|
+
Get the bundled version of Vega
|
|
1442
|
+
|
|
1443
|
+
Returns
|
|
1444
|
+
-------
|
|
1445
|
+
Vega version string (e.g. "5.30.0")
|
|
1446
|
+
"""
|
|
1447
|
+
...
|
|
1448
|
+
|
|
1449
|
+
def get_vega_themes_version() -> str:
|
|
1450
|
+
"""
|
|
1451
|
+
Get the bundled version of Vega-Themes
|
|
1452
|
+
|
|
1453
|
+
Returns
|
|
1454
|
+
-------
|
|
1455
|
+
Vega-Themes version string (e.g. "2.14.0")
|
|
1456
|
+
"""
|
|
1457
|
+
...
|
|
1458
|
+
|
|
1459
|
+
def get_vega_embed_version() -> str:
|
|
1460
|
+
"""
|
|
1461
|
+
Get the bundled version of Vega-Embed
|
|
1462
|
+
|
|
1463
|
+
Returns
|
|
1464
|
+
-------
|
|
1465
|
+
Vega-Embed version string (e.g. "6.26.0")
|
|
1466
|
+
"""
|
|
1467
|
+
...
|
|
1468
|
+
|
|
1469
|
+
def get_vegalite_versions() -> list[str]:
|
|
1470
|
+
"""
|
|
1471
|
+
Get the bundled versions of Vega-Lite
|
|
1472
|
+
|
|
1473
|
+
Returns
|
|
1474
|
+
-------
|
|
1475
|
+
Vega-Lite version strings (e.g. ["5.8", "5.9", ..., "5.21"])
|
|
1476
|
+
"""
|
|
1477
|
+
...
|
|
1478
|
+
|
|
1479
|
+
if TYPE_CHECKING:
|
|
1480
|
+
class _AsyncioModule:
|
|
1481
|
+
def get_format_locale(self, name: FormatLocaleName) -> dict[str, Any]:
|
|
1482
|
+
"""See :func:`vl_convert.get_format_locale` for full documentation."""
|
|
1483
|
+
...
|
|
1484
|
+
async def get_local_tz(self) -> str | None:
|
|
1485
|
+
"""Async version of ``get_local_tz``. See sync function for full documentation."""
|
|
1486
|
+
...
|
|
1487
|
+
async def get_themes(self) -> dict[VegaThemes, dict[str, Any]]:
|
|
1488
|
+
"""Async version of ``get_themes``. See sync function for full documentation."""
|
|
1489
|
+
...
|
|
1490
|
+
def get_time_format_locale(self, name: TimeFormatLocaleName) -> dict[str, Any]:
|
|
1491
|
+
"""See :func:`vl_convert.get_time_format_locale` for full documentation."""
|
|
1492
|
+
...
|
|
1493
|
+
async def javascript_bundle(
|
|
1494
|
+
self, snippet: str | None = None, vl_version: str | None = None
|
|
1495
|
+
) -> str:
|
|
1496
|
+
"""Async version of ``javascript_bundle``. See sync function for full documentation."""
|
|
1497
|
+
...
|
|
1498
|
+
async def register_font_directory(self, font_dir: str) -> None:
|
|
1499
|
+
"""Async version of ``register_font_directory``. See sync function for full documentation."""
|
|
1500
|
+
...
|
|
1501
|
+
async def set_font_directories(self, font_dirs: list[str]) -> None:
|
|
1502
|
+
"""Async version of ``set_font_directories``. See sync function for full documentation."""
|
|
1503
|
+
...
|
|
1504
|
+
def current_font_directories(self) -> list[str]:
|
|
1505
|
+
"""Synchronous re-export of ``current_font_directories``. See sync function for full documentation."""
|
|
1506
|
+
...
|
|
1507
|
+
def google_fonts_cache_dir(self) -> str | None:
|
|
1508
|
+
"""Synchronous re-export of ``google_fonts_cache_dir``. See sync function for full documentation."""
|
|
1509
|
+
...
|
|
1510
|
+
def google_fonts_cache_size_mb(self) -> int:
|
|
1511
|
+
"""Synchronous re-export of ``google_fonts_cache_size_mb``. See sync function for full documentation."""
|
|
1512
|
+
...
|
|
1513
|
+
def set_google_fonts_cache_size_mb(self, max_size_mb: int | None) -> None:
|
|
1514
|
+
"""Synchronous re-export of ``set_google_fonts_cache_size_mb``. See sync function for full documentation."""
|
|
1515
|
+
...
|
|
1516
|
+
async def configure(
|
|
1517
|
+
self,
|
|
1518
|
+
*,
|
|
1519
|
+
num_workers: int | None = None,
|
|
1520
|
+
base_url: str | bool | None = None,
|
|
1521
|
+
allowed_base_urls: list[str] | None = None,
|
|
1522
|
+
auto_google_fonts: bool | None = None,
|
|
1523
|
+
embed_local_fonts: bool | None = None,
|
|
1524
|
+
subset_fonts: bool | None = None,
|
|
1525
|
+
missing_fonts: Literal["fallback", "warn", "error"] | None = None,
|
|
1526
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1527
|
+
google_font_variant_threshold: int | None = None,
|
|
1528
|
+
max_v8_heap_size_mb: int | None = None,
|
|
1529
|
+
max_v8_execution_time_secs: int | None = None,
|
|
1530
|
+
gc_after_conversion: bool | None = None,
|
|
1531
|
+
vega_plugins: list[str] | None = None,
|
|
1532
|
+
plugin_import_domains: list[str] | None = None,
|
|
1533
|
+
allow_per_request_plugins: bool | None = None,
|
|
1534
|
+
max_ephemeral_workers: int | None = None,
|
|
1535
|
+
allow_google_fonts: bool | None = None,
|
|
1536
|
+
per_request_plugin_import_domains: list[str] | None = None,
|
|
1537
|
+
default_theme: str | None = None,
|
|
1538
|
+
default_format_locale: str | dict[str, Any] | None = None,
|
|
1539
|
+
default_time_format_locale: str | dict[str, Any] | None = None,
|
|
1540
|
+
themes: dict[str, dict[str, Any]] | None = None,
|
|
1541
|
+
) -> None:
|
|
1542
|
+
"""Async version of ``configure``. See sync function for full documentation."""
|
|
1543
|
+
...
|
|
1544
|
+
async def load_config(self, path: str | None = None) -> None:
|
|
1545
|
+
"""Async version of ``load_config``. See sync function for full documentation."""
|
|
1546
|
+
...
|
|
1547
|
+
async def get_config(self) -> ConverterConfig:
|
|
1548
|
+
"""Async version of ``get_config``. See sync function for full documentation."""
|
|
1549
|
+
...
|
|
1550
|
+
async def warm_up_workers(self) -> None:
|
|
1551
|
+
"""Async version of ``warm_up_workers``. See sync function for full documentation."""
|
|
1552
|
+
...
|
|
1553
|
+
async def get_worker_memory_usage(self) -> list[WorkerMemoryUsage]:
|
|
1554
|
+
"""Async version of ``get_worker_memory_usage``. See sync function for full documentation."""
|
|
1555
|
+
...
|
|
1556
|
+
async def svg_to_jpeg(
|
|
1557
|
+
self, svg: str, scale: float | None = None, quality: int | None = None
|
|
1558
|
+
) -> bytes:
|
|
1559
|
+
"""Async version of ``svg_to_jpeg``. See sync function for full documentation."""
|
|
1560
|
+
...
|
|
1561
|
+
async def svg_to_pdf(self, svg: str) -> bytes:
|
|
1562
|
+
"""Async version of ``svg_to_pdf``. See sync function for full documentation."""
|
|
1563
|
+
...
|
|
1564
|
+
async def svg_to_png(
|
|
1565
|
+
self, svg: str, scale: float | None = None, ppi: float | None = None
|
|
1566
|
+
) -> bytes:
|
|
1567
|
+
"""Async version of ``svg_to_png``. See sync function for full documentation."""
|
|
1568
|
+
...
|
|
1569
|
+
async def vega_to_html(
|
|
1570
|
+
self,
|
|
1571
|
+
vg_spec: VlSpec,
|
|
1572
|
+
*,
|
|
1573
|
+
bundle: bool | None = None,
|
|
1574
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1575
|
+
format_locale: FormatLocale | None = None,
|
|
1576
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1577
|
+
renderer: Renderer | None = None,
|
|
1578
|
+
vega_plugin: str | None = None,
|
|
1579
|
+
config: str | dict[str, Any] | None = None,
|
|
1580
|
+
background: str | None = None,
|
|
1581
|
+
width: float | None = None,
|
|
1582
|
+
height: float | None = None,
|
|
1583
|
+
) -> str:
|
|
1584
|
+
"""Async version of ``vega_to_html``. See sync function for full documentation."""
|
|
1585
|
+
...
|
|
1586
|
+
async def vega_to_jpeg(
|
|
1587
|
+
self,
|
|
1588
|
+
vg_spec: VlSpec,
|
|
1589
|
+
*,
|
|
1590
|
+
scale: float | None = None,
|
|
1591
|
+
quality: int | None = None,
|
|
1592
|
+
format_locale: FormatLocale | None = None,
|
|
1593
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1594
|
+
vega_plugin: str | None = None,
|
|
1595
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1596
|
+
config: str | dict[str, Any] | None = None,
|
|
1597
|
+
background: str | None = None,
|
|
1598
|
+
width: float | None = None,
|
|
1599
|
+
height: float | None = None,
|
|
1600
|
+
) -> bytes:
|
|
1601
|
+
"""Async version of ``vega_to_jpeg``. See sync function for full documentation."""
|
|
1602
|
+
...
|
|
1603
|
+
async def vega_to_pdf(
|
|
1604
|
+
self,
|
|
1605
|
+
vg_spec: VlSpec,
|
|
1606
|
+
*,
|
|
1607
|
+
format_locale: FormatLocale | None = None,
|
|
1608
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1609
|
+
vega_plugin: str | None = None,
|
|
1610
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1611
|
+
config: str | dict[str, Any] | None = None,
|
|
1612
|
+
background: str | None = None,
|
|
1613
|
+
width: float | None = None,
|
|
1614
|
+
height: float | None = None,
|
|
1615
|
+
) -> bytes:
|
|
1616
|
+
"""Async version of ``vega_to_pdf``. See sync function for full documentation."""
|
|
1617
|
+
...
|
|
1618
|
+
async def vega_to_png(
|
|
1619
|
+
self,
|
|
1620
|
+
vg_spec: VlSpec,
|
|
1621
|
+
*,
|
|
1622
|
+
scale: float | None = None,
|
|
1623
|
+
ppi: float | None = None,
|
|
1624
|
+
format_locale: FormatLocale | None = None,
|
|
1625
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1626
|
+
vega_plugin: str | None = None,
|
|
1627
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1628
|
+
config: str | dict[str, Any] | None = None,
|
|
1629
|
+
background: str | None = None,
|
|
1630
|
+
width: float | None = None,
|
|
1631
|
+
height: float | None = None,
|
|
1632
|
+
) -> bytes:
|
|
1633
|
+
"""Async version of ``vega_to_png``. See sync function for full documentation."""
|
|
1634
|
+
...
|
|
1635
|
+
async def vega_to_scenegraph(
|
|
1636
|
+
self,
|
|
1637
|
+
vg_spec: VlSpec,
|
|
1638
|
+
*,
|
|
1639
|
+
format_locale: FormatLocale | None = None,
|
|
1640
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1641
|
+
format: Literal["dict", "msgpack"] = "dict",
|
|
1642
|
+
vega_plugin: str | None = None,
|
|
1643
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1644
|
+
config: str | dict[str, Any] | None = None,
|
|
1645
|
+
background: str | None = None,
|
|
1646
|
+
width: float | None = None,
|
|
1647
|
+
height: float | None = None,
|
|
1648
|
+
) -> dict[str, Any] | bytes:
|
|
1649
|
+
"""Async version of ``vega_to_scenegraph``. See sync function for full documentation."""
|
|
1650
|
+
...
|
|
1651
|
+
async def vega_to_svg(
|
|
1652
|
+
self,
|
|
1653
|
+
vg_spec: VlSpec,
|
|
1654
|
+
*,
|
|
1655
|
+
format_locale: FormatLocale | None = None,
|
|
1656
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1657
|
+
vega_plugin: str | None = None,
|
|
1658
|
+
bundle: bool | None = None,
|
|
1659
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1660
|
+
config: str | dict[str, Any] | None = None,
|
|
1661
|
+
background: str | None = None,
|
|
1662
|
+
width: float | None = None,
|
|
1663
|
+
height: float | None = None,
|
|
1664
|
+
) -> str:
|
|
1665
|
+
"""Async version of ``vega_to_svg``. See sync function for full documentation."""
|
|
1666
|
+
...
|
|
1667
|
+
async def vega_to_url(
|
|
1668
|
+
self, vg_spec: VlSpec, fullscreen: bool | None = None
|
|
1669
|
+
) -> str:
|
|
1670
|
+
"""Async version of ``vega_to_url``. See sync function for full documentation."""
|
|
1671
|
+
...
|
|
1672
|
+
async def vegalite_fonts(
|
|
1673
|
+
self,
|
|
1674
|
+
vl_spec: VlSpec,
|
|
1675
|
+
vl_version: str | None = None,
|
|
1676
|
+
config: dict[str, Any] | None = None,
|
|
1677
|
+
theme: VegaThemes | None = None,
|
|
1678
|
+
auto_google_fonts: bool | None = None,
|
|
1679
|
+
include_font_face: bool = False,
|
|
1680
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1681
|
+
format_locale: FormatLocale | None = None,
|
|
1682
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1683
|
+
) -> list[FontInfo]:
|
|
1684
|
+
"""Async version of ``vegalite_fonts``. See sync function for full documentation."""
|
|
1685
|
+
...
|
|
1686
|
+
async def vega_fonts(
|
|
1687
|
+
self,
|
|
1688
|
+
vg_spec: VlSpec,
|
|
1689
|
+
auto_google_fonts: bool | None = None,
|
|
1690
|
+
include_font_face: bool = False,
|
|
1691
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1692
|
+
format_locale: FormatLocale | None = None,
|
|
1693
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1694
|
+
) -> list[FontInfo]:
|
|
1695
|
+
"""Async version of ``vega_fonts``. See sync function for full documentation."""
|
|
1696
|
+
...
|
|
1697
|
+
async def vegalite_to_html(
|
|
1698
|
+
self,
|
|
1699
|
+
vl_spec: VlSpec,
|
|
1700
|
+
*,
|
|
1701
|
+
vl_version: str | None = None,
|
|
1702
|
+
bundle: bool | None = None,
|
|
1703
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1704
|
+
config: dict[str, Any] | None = None,
|
|
1705
|
+
theme: VegaThemes | None = None,
|
|
1706
|
+
format_locale: FormatLocale | None = None,
|
|
1707
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1708
|
+
renderer: Renderer | None = None,
|
|
1709
|
+
vega_plugin: str | None = None,
|
|
1710
|
+
background: str | None = None,
|
|
1711
|
+
width: float | None = None,
|
|
1712
|
+
height: float | None = None,
|
|
1713
|
+
) -> str:
|
|
1714
|
+
"""Async version of ``vegalite_to_html``. See sync function for full documentation."""
|
|
1715
|
+
...
|
|
1716
|
+
async def vegalite_to_jpeg(
|
|
1717
|
+
self,
|
|
1718
|
+
vl_spec: VlSpec,
|
|
1719
|
+
*,
|
|
1720
|
+
vl_version: str | None = None,
|
|
1721
|
+
scale: float | None = None,
|
|
1722
|
+
quality: int | None = None,
|
|
1723
|
+
config: dict[str, Any] | None = None,
|
|
1724
|
+
theme: VegaThemes | None = None,
|
|
1725
|
+
show_warnings: bool | None = None,
|
|
1726
|
+
format_locale: FormatLocale | None = None,
|
|
1727
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1728
|
+
vega_plugin: str | None = None,
|
|
1729
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1730
|
+
background: str | None = None,
|
|
1731
|
+
width: float | None = None,
|
|
1732
|
+
height: float | None = None,
|
|
1733
|
+
) -> bytes:
|
|
1734
|
+
"""Async version of ``vegalite_to_jpeg``. See sync function for full documentation."""
|
|
1735
|
+
...
|
|
1736
|
+
async def vegalite_to_pdf(
|
|
1737
|
+
self,
|
|
1738
|
+
vl_spec: VlSpec,
|
|
1739
|
+
*,
|
|
1740
|
+
vl_version: str | None = None,
|
|
1741
|
+
config: dict[str, Any] | None = None,
|
|
1742
|
+
theme: VegaThemes | None = None,
|
|
1743
|
+
format_locale: FormatLocale | None = None,
|
|
1744
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1745
|
+
vega_plugin: str | None = None,
|
|
1746
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1747
|
+
background: str | None = None,
|
|
1748
|
+
width: float | None = None,
|
|
1749
|
+
height: float | None = None,
|
|
1750
|
+
) -> bytes:
|
|
1751
|
+
"""Async version of ``vegalite_to_pdf``. See sync function for full documentation."""
|
|
1752
|
+
...
|
|
1753
|
+
async def vegalite_to_png(
|
|
1754
|
+
self,
|
|
1755
|
+
vl_spec: VlSpec,
|
|
1756
|
+
*,
|
|
1757
|
+
vl_version: str | None = None,
|
|
1758
|
+
scale: float | None = None,
|
|
1759
|
+
ppi: float | None = None,
|
|
1760
|
+
config: dict[str, Any] | None = None,
|
|
1761
|
+
theme: VegaThemes | None = None,
|
|
1762
|
+
show_warnings: bool | None = None,
|
|
1763
|
+
format_locale: FormatLocale | None = None,
|
|
1764
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1765
|
+
vega_plugin: str | None = None,
|
|
1766
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1767
|
+
background: str | None = None,
|
|
1768
|
+
width: float | None = None,
|
|
1769
|
+
height: float | None = None,
|
|
1770
|
+
) -> bytes:
|
|
1771
|
+
"""Async version of ``vegalite_to_png``. See sync function for full documentation."""
|
|
1772
|
+
...
|
|
1773
|
+
async def vegalite_to_scenegraph(
|
|
1774
|
+
self,
|
|
1775
|
+
vl_spec: VlSpec,
|
|
1776
|
+
*,
|
|
1777
|
+
vl_version: str | None = None,
|
|
1778
|
+
config: dict[str, Any] | None = None,
|
|
1779
|
+
theme: VegaThemes | None = None,
|
|
1780
|
+
show_warnings: bool | None = None,
|
|
1781
|
+
format_locale: FormatLocale | None = None,
|
|
1782
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1783
|
+
format: Literal["dict", "msgpack"] = "dict",
|
|
1784
|
+
vega_plugin: str | None = None,
|
|
1785
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1786
|
+
background: str | None = None,
|
|
1787
|
+
width: float | None = None,
|
|
1788
|
+
height: float | None = None,
|
|
1789
|
+
) -> dict[str, Any] | bytes:
|
|
1790
|
+
"""Async version of ``vegalite_to_scenegraph``. See sync function for full documentation."""
|
|
1791
|
+
...
|
|
1792
|
+
async def vegalite_to_svg(
|
|
1793
|
+
self,
|
|
1794
|
+
vl_spec: VlSpec,
|
|
1795
|
+
*,
|
|
1796
|
+
vl_version: str | None = None,
|
|
1797
|
+
config: dict[str, Any] | None = None,
|
|
1798
|
+
theme: VegaThemes | None = None,
|
|
1799
|
+
show_warnings: bool | None = None,
|
|
1800
|
+
format_locale: FormatLocale | None = None,
|
|
1801
|
+
time_format_locale: TimeFormatLocale | None = None,
|
|
1802
|
+
vega_plugin: str | None = None,
|
|
1803
|
+
bundle: bool | None = None,
|
|
1804
|
+
google_fonts: list[str | GoogleFontSpec] | None = None,
|
|
1805
|
+
background: str | None = None,
|
|
1806
|
+
width: float | None = None,
|
|
1807
|
+
height: float | None = None,
|
|
1808
|
+
) -> str:
|
|
1809
|
+
"""Async version of ``vegalite_to_svg``. See sync function for full documentation."""
|
|
1810
|
+
...
|
|
1811
|
+
async def vegalite_to_url(
|
|
1812
|
+
self, vl_spec: VlSpec, fullscreen: bool | None = None
|
|
1813
|
+
) -> str:
|
|
1814
|
+
"""Async version of ``vegalite_to_url``. See sync function for full documentation."""
|
|
1815
|
+
...
|
|
1816
|
+
async def vegalite_to_vega(
|
|
1817
|
+
self,
|
|
1818
|
+
vl_spec: VlSpec,
|
|
1819
|
+
*,
|
|
1820
|
+
vl_version: str | None = None,
|
|
1821
|
+
config: dict[str, Any] | None = None,
|
|
1822
|
+
theme: VegaThemes | None = None,
|
|
1823
|
+
show_warnings: bool | None = None,
|
|
1824
|
+
) -> dict[str, Any]:
|
|
1825
|
+
"""Async version of ``vegalite_to_vega``. See sync function for full documentation."""
|
|
1826
|
+
...
|
|
1827
|
+
def get_vega_version(self) -> str:
|
|
1828
|
+
"""See :func:`vl_convert.get_vega_version` for full documentation."""
|
|
1829
|
+
...
|
|
1830
|
+
def get_vega_themes_version(self) -> str:
|
|
1831
|
+
"""See :func:`vl_convert.get_vega_themes_version` for full documentation."""
|
|
1832
|
+
...
|
|
1833
|
+
def get_vega_embed_version(self) -> str:
|
|
1834
|
+
"""See :func:`vl_convert.get_vega_embed_version` for full documentation."""
|
|
1835
|
+
...
|
|
1836
|
+
def get_vegalite_versions(self) -> list[str]:
|
|
1837
|
+
"""See :func:`vl_convert.get_vegalite_versions` for full documentation."""
|
|
1838
|
+
...
|
|
1839
|
+
def get_config_path(self) -> str:
|
|
1840
|
+
"""See :func:`vl_convert.get_config_path` for full documentation."""
|
|
1841
|
+
...
|
|
1842
|
+
|
|
1843
|
+
asyncio: _AsyncioModule
|