-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Make imports of heavy packages lazy #491
Conversation
@@ -82,6 +81,3 @@ def spec_to_mime_bundle( | |||
return {"image/png": png} | |||
else: | |||
raise ValueError(f"Unsupported mimetype: {mimetype}") | |||
|
|||
|
|||
alt.renderers.register('vegafusion-mime', vegafusion_mime_renderer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now registered using an entry point to avoid the need to import altair
return None | ||
group = child_group | ||
|
||
return group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved out from evaluation.py since it's not used there any more
|
||
|
||
alt.data_transformers.register("vegafusion-feather", feather_transformer) | ||
alt.data_transformers.register("vegafusion-inline", inline_data_transformer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to entry point for registration so as to not import altair for register
Improve VegaFusion import time by making the imports of the following packages lazy:
pyarrow
polars
pandas
duckdb
altair
Previously these would all be imported eagerly if they are installed, which could lead to multi-second import time if VegaFusion is used in an environment where they are all installed.
To make it easier to make
altair
lazy, I updated thetransformed_data
function to delegate to the Altair implementation.