tonybaloney / wily

A Python application for tracking, reporting on timing and complexity in Python code
Apache License 2.0
1.2k stars 58 forks source link

Allow standalone plotly.min.js when creating graphs #189

Closed devdanzin closed 12 months ago

devdanzin commented 1 year ago

When creating graphs, wily currently inlines the contents of plotly.min.js in HTML files, making their size around 3.4MB each. When creating a lot of graphs, this quickly adds up to a lot of space. For example, bulk creating graphs for every metric for every file that ever existed in wily's repository takes around 5GB in about 1500 HTML files.

Plotly has an option to create plotly.min.js once, in the same directory, and reference it from the HTML file. It's enabled by calling plotly.offline.plot with include_plotlyjs="directory". It reduces the size of the same 1500 graphs from 5GB to under 100MB.

I'm not sure adding this feature would be in scope for wily, but I have it working locally and could contribute a PR if it's desirable. It would also add a new CLI option for graph to enable this behavior.