Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define vl-convert-python dependency outside of altair[all] #3608

Open
apoorvkh opened this issue Sep 23, 2024 · 3 comments · May be fixed by #3609
Open

Define vl-convert-python dependency outside of altair[all] #3608

apoorvkh opened this issue Sep 23, 2024 · 3 comments · May be fixed by #3609
Labels
dependencies Pull requests that update a dependency file maintenance

Comments

@apoorvkh
Copy link

What is your suggestion?

The vl-convert-python package is necessary for saving plots in PNG / SVG / PDF formats. I believe this is a rather critical function, so I'm wondering why vl-convert-python needs to be manually installed for this capability. (I see that altair[all] is an alternative, but I think vega_datasets, etc. are less critical than the save functionality.)

vl-convert-python has zero dependencies. So I think this would be a simple addition. Maybe that is the reason Is this dependency optional because the built wheels are ~30 MB? Could this size be reduced?

Thanks so much for your consideration!

Have you considered any alternative solutions?

Alternatively, could this (at least) be added to a new optional dependency group altair[save], as suggested here?

@jonmmease
Copy link
Contributor

Hi @apoorvkh,
As you noticed, vl-convert-python is a native compiled wheel, and it's fairly large. Both of these are consequences of the fact that vl-convert embeds the V8 JavaScript runtime (through the Deno project) in order to run the Vega-Lite and Vega JavaScript libraries without external dependencies. There is no obvious way, that I'm aware of, to reduce the size of vl-convert without reducing functionality.

This can't be a required dependency of the altair package, because it would prevent Altair's use in architectures that aren't supported by Deno, but do run Python. A prominent example of this is Pyodide, for running Python in the browser.

I don't have a problem with adding an additional dependency group, but could you say more about why you wouldn't want to use the all group?

@apoorvkh
Copy link
Author

Thanks a lot for the explanation!

could you say more about why you wouldn't want to use the all group?

I just want to use Altair to plot / interact with my data and save to a static file, so I can put figures in my academic papers. I simply don't need any of these (besides vl-convert-python)! So I prefer not to depend on them (if I can) to avoid potential conflicts. And I am just bringing this up, because I feel that saving plots to static files is a rather core functionality.

altair/pyproject.toml

Lines 57 to 66 in 712680b

all = [
"vega_datasets>=0.9.0",
"vl-convert-python>=1.6.0",
"pandas>=0.25.3",
"numpy",
"pyarrow>=11",
"vegafusion[embed]>=1.6.6",
"anywidget>=0.9.0",
"altair_tiles>=0.3.0"
]

E.g. not even pandas because I am using polars; surprisingly, not even numpy, because torch seems to cover everything I need that is ML-related.

@apoorvkh
Copy link
Author

I made a simple PR with the change, in case this is sufficiently compelling to you. Please let me know, thanks!

#3609

@dangotbanned dangotbanned changed the title Move vl-convert-python to dependencies Define vl-convert-python dependency outside of altair[all] Sep 24, 2024
@dangotbanned dangotbanned added maintenance dependencies Pull requests that update a dependency file and removed enhancement labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file maintenance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants