dash
dash copied to clipboard
provide a minified version of Dash taht doesn't include Plotly
Is your feature request related to a problem? Please describe.
Yes, this concerns the "package size" of dash projects, which usually exceed 200mb, when they certainly don't need to for projects that don't need plotly and only dash.
I tested this both on a remote server (serving the dash app) on linux and inside a venv on windows - the package size is dominated by plotly (screenshot for reference).
Describe the solution you'd like
A "minified" version of dash that doesn't include plotly features.
I think dash has matured enough after so many years to be a very viable package on its own - something I can attest to.
Describe alternatives you've considered Using other packages like streamlit? - not comprehensive, not customizable enough Using flask with templates? - defeats the whole purpose of having dash
Additional context I posted this community thread which did not get "solved"
+1. Especially as there are now other visualization libraries which are compatible with Dash such as Vega-Altair using dash-vega-components (disclosure: I'm the author).
Thanks @plutonium-239 - so there are two ways we could go here:
- Make a flavor of
dashthat doesn't requireplotly. I think we still want the default installation to include it, but we could imagine making adash-baseor some such package that omits it. Two pieces to consider:dashinherits its JSON encoder fromplotly- this would need to be moved to a separate package.dcc.Graphby default takes plotly.js directly fromplotly. If you don't intend to useplotlywe should probably omitdcc.Graphentirely.
- Reduce the size of the
plotlypackage. This package takes 15MB to download but balloons to 100MB (on my machine it looks like 140MB even) extracted. That means there's a whole lot of repetition in it, which we could likely improve on. Indeed, the vast majority of this space (if you look one level deeper in the tree) is ingraph_objsandvalidators, both codegen outputs with many nearly identical files. The caveat here is these are optimized for IDE code completion and auto help so we'd need to be careful to preserve those, but in a cursory look I already see some low-hanging fruit without substantial refactoring.
Thanks @alexcjohnson, this looks amazing!
I am willing to contribute as well - I have been looking through the plotly and dash repos recently.
The JSON encoder was also one of the first things I found.
Removing dcc.Graph sounds like the move because that is the functionality we are trying to remove.
As for the plotly package size, I do see a lot of the same folders and files in graph_objs and validators now. However, I don't understand the purpose of the validators sub-package yet.
Although this is viable I don't really know what to do in this case
Which do you think would be favorable? I don't think they are mutually exclusive anyways!
Correct, they're not mutually exclusive. Reducing the size of plotly would be the bigger win because it would help everybody (including the large majority of plotly users who are NOT dash users). And because we want to keep the default dash installation as is we'd need to create a different installation pathway for the no-plotly version. Not the first time I've wished Python had an "optional omission" syntax like it has for optional installs, it would be nice if we could just do pip install dash[no-plotly] but that's not an option so we'd need a separate package. Same is true if we ever tried to make Dash compatible with servers other than Flask...