-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rename vegafusion-jupyter renderer to vegafusion-widget Rename vf.jupyter.enable to vf.jupyter.enable_widget() * Add initial vegafusion-inline transformer and vegafusion-mime renderer * Move mime renderer to vegafusion package Add top-level vf.enable_mime()/enable_widget() methods * Add local timezone configuration * Add eval_transforms function that returns the result of evaluating the transforms on a Chart * Don't use editable install in build:dev to get nbextension working for development * Add row_limit to pre_transform_values * Add html, svg, and png render mime types * Test html mimetype * Add transformed_dtypes * Initial support for row/column encoding facets * Lookup Altair's vegalite version dynamically * Thread embed options through to mime renderer * Merge embed options and fix bundle embed metadata * work around to avoid white background in dark theme * Support custom vegalite-to-vega compiler plugins * Add better error message in local_tz if vl-convert is not available * Install vl-convert-python in CI * Derive Debug for Plan * For selection stores with inline data, keep values on both client and server * Fix "dispatch dropped without returning error" test error Sharing a reqwest Client across tokio runtimes can result in "dispatch dropped without returning error" error. This removes the lazy_static client and reconstructs the client on demand * Check client-only-vars in determining if signal is supported
- Loading branch information
Showing
29 changed files
with
911 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from altair.utils.plugin_registry import PluginRegistry | ||
from typing import Callable | ||
|
||
|
||
VegaLiteCompilerType = Callable[..., dict] | ||
|
||
|
||
class VegaLiteCompilerRegistry(PluginRegistry[VegaLiteCompilerType]): | ||
pass | ||
|
||
|
||
vegalite_compilers = VegaLiteCompilerRegistry() | ||
|
||
|
||
def vl_convert_compiler(vegalite_spec) -> dict: | ||
try: | ||
import vl_convert as vlc | ||
except ImportError: | ||
raise ImportError( | ||
"The vl-convert Vega-Lite compiler requires the vl-convert-python package" | ||
) | ||
|
||
from . import altair_vl_version | ||
vega_spec = vlc.vegalite_to_vega(vegalite_spec, vl_version=altair_vl_version(vl_convert=True)) | ||
return vega_spec | ||
|
||
|
||
vegalite_compilers.register("vl-convert", vl_convert_compiler) | ||
vegalite_compilers.enable("vl-convert") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
__tz_config = dict(local_tz=None) | ||
|
||
|
||
def get_local_tz(): | ||
""" | ||
Get the named local timezone that the VegaFusion mimetype renderer | ||
will use for calculations. | ||
Defaults to the kernel's local timezone as determined by vl-convert. | ||
Has no effect on VegaFusionWidget, which always uses the | ||
browser's local timezone | ||
:return: named timezone string | ||
""" | ||
if __tz_config["local_tz"] is None: | ||
# Fall back to getting local_tz from vl-convert if not set | ||
try: | ||
import vl_convert as vlc | ||
__tz_config["local_tz"] = vlc.get_local_tz() | ||
except ImportError: | ||
raise ImportError( | ||
"vl-convert is not installed and so the local system timezone cannot be determined.\n" | ||
"Either install the vl-convert-python package or set the local timezone manually using\n" | ||
"the vegafusion.set_local_tz function" | ||
) | ||
|
||
return __tz_config["local_tz"] | ||
|
||
|
||
def set_local_tz(local_tz): | ||
""" | ||
Set the named local timezone that the VegaFusion mimetype renderer | ||
will use for calculations. | ||
Has no effect on VegaFusionWidget, which always uses the | ||
browser's local timezone | ||
:param local_tz: Named local timezone (e.g. "America/New_York") | ||
""" | ||
__tz_config["local_tz"] = local_tz |
Oops, something went wrong.