plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
21.39k stars 2.06k forks source link

provide a minified version of Dash taht doesn't include Plotly #2684

Open plutonium-239 opened 11 months ago

plutonium-239 commented 11 months ago

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). image

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"

binste commented 11 months ago

+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).

alexcjohnson commented 11 months ago

Thanks @plutonium-239 - so there are two ways we could go here:

plutonium-239 commented 11 months ago

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!

alexcjohnson commented 11 months ago

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...