diff --git a/python/vegafusion-jupyter/tests/test_altair_mocks.py b/python/vegafusion-jupyter/tests/test_altair_mocks.py index 5350d0dd0..b2b01b7d9 100644 --- a/python/vegafusion-jupyter/tests/test_altair_mocks.py +++ b/python/vegafusion-jupyter/tests/test_altair_mocks.py @@ -85,7 +85,7 @@ ```python import altair as alt import vegafusion as vf -vf.enable_mime(mimetype="html", embed_options={'actions': False}) +vf.enable(mimetype="html", embed_options={'actions': False}) ``` ```python diff --git a/python/vegafusion/tests/test_conext_manager.py b/python/vegafusion/tests/test_conext_manager.py index f6035a071..2cdfe6e58 100644 --- a/python/vegafusion/tests/test_conext_manager.py +++ b/python/vegafusion/tests/test_conext_manager.py @@ -21,14 +21,14 @@ def test_mime_enabler_context_manager(): assert alt.renderers.active == "default" assert repr(ctx) == "vegafusion.disable()" - with vf.enable_mime(): + with vf.enable(): assert alt.data_transformers.active == "vegafusion-inline" assert alt.renderers.active == "vegafusion-mime" assert alt.data_transformers.active == "default" assert alt.renderers.active == "default" - ctx = vf.enable_mime() + ctx = vf.enable() assert alt.data_transformers.active == "vegafusion-inline" assert alt.renderers.active == "vegafusion-mime" - assert repr(ctx) == "vegafusion.enable_mime(mimetype='html', row_limit=10000, embed_options=None)" + assert repr(ctx) == "vegafusion.enable(mimetype='html', row_limit=10000, embed_options=None)" diff --git a/python/vegafusion/tests/test_row_limit.py b/python/vegafusion/tests/test_row_limit.py index 2fc3998ba..f9bbbd1a5 100644 --- a/python/vegafusion/tests/test_row_limit.py +++ b/python/vegafusion/tests/test_row_limit.py @@ -14,11 +14,11 @@ def test_row_limit(): # Dataset has 406 rows (before filtering out nulls) and this chart is not aggregated. # Limit of 500 rows should be fine - with vf.enable_mime(row_limit=500): + with vf.enable(row_limit=500): chart._repr_mimebundle_() # Limit of 300 rows should raise RowLimitError - with vf.enable_mime(row_limit=300): + with vf.enable(row_limit=300): with pytest.raises(vf.RowLimitError): chart._repr_mimebundle_() @@ -28,5 +28,5 @@ def test_row_limit(): alt.Y("Miles_per_Gallon", bin=True), alt.Size("count()") ) - with vf.enable_mime(row_limit=50): + with vf.enable(row_limit=50): chart._repr_mimebundle_() diff --git a/python/vegafusion/vegafusion/__init__.py b/python/vegafusion/vegafusion/__init__.py index 71450ad52..0032fb8fd 100644 --- a/python/vegafusion/vegafusion/__init__.py +++ b/python/vegafusion/vegafusion/__init__.py @@ -46,13 +46,11 @@ def altair_vl_version(vl_convert=False): return SCHEMA_VERSION.rstrip("v") -def enable_mime(mimetype="html", row_limit=10000, embed_options=None): +def enable(mimetype="html", row_limit=10000, embed_options=None): """ - Enable the VegaFusion data transformer and renderer so that all Charts + Enable the VegaFusion mime renderer so that all Altair charts are displayed using VegaFusion. - This isn't necessary in order to use the VegaFusionWidget directly - :param mimetype: Mime type. One of: - "html" (default) - "vega" @@ -71,7 +69,7 @@ def enable_mime(mimetype="html", row_limit=10000, embed_options=None): ), data_transformer_ctx=alt.data_transformers.enable('vegafusion-inline'), repr_str=( - "vegafusion.enable_mime(" + "vegafusion.enable(" f"mimetype={repr(mimetype)}, row_limit={row_limit}, embed_options={repr(embed_options)}" ")" ) @@ -79,11 +77,23 @@ def enable_mime(mimetype="html", row_limit=10000, embed_options=None): def enable_widget( - download_source_link=None, debounce_wait=30, debounce_max_wait=60, - data_dir="_vegafusion_data" + data_dir="_vegafusion_data", + download_source_link=None, ): + """ + Enable the VegaFusion widget renderer so that all charts are displayed + using VegaFusion. + + This isn't necessary in order to use the VegaFusionWidget directly + + :param debounce_wait: Debounce wait period for interactions (milliseconds) + :param debounce_max_wait: Max debounce wait for interactions (milliseconds) + :param download_source_link: URL of notebooks source code for inclusion + in dropdown menu + :param data_dir: Path that temporary feather files will be written to + """ from vegafusion.jupyter import enable return enable( download_source_link=download_source_link, diff --git a/python/vegafusion/vegafusion/renderer.py b/python/vegafusion/vegafusion/renderer.py index 70060c03e..ef94ac44a 100644 --- a/python/vegafusion/vegafusion/renderer.py +++ b/python/vegafusion/vegafusion/renderer.py @@ -10,7 +10,7 @@ def __str__(self): return ( f"Limit of {self.row_limit} rows was exceeded.\n" "Either introduce an aggregation to reduce the number of rows sent to the client or\n" - "increase the row_limit argument to the vegafusion.enable_mime() function" + "increase the row_limit argument to the vegafusion.enable() function" )