bloomberg / memray

Memray is a memory profiler for Python
https://bloomberg.github.io/memray/
Apache License 2.0
12.76k stars 372 forks source link

--no-web Packaging Option #470

Open Delengowski opened 9 months ago

Delengowski commented 9 months ago

Is there an existing proposal for this?

Is your feature request related to a problem?

I have an issue utilizing the flamegraph and table output options when using memray on an airgapped system. Since the system does not have internet access, connecting to the CDNs to get the javascript is not possible and the web pages aren't fully loaded.

Describe the solution you'd like

I would like it if memray would in a --no-web packaging option that would include the necessary html/css/js files as part of memray and have the the generated html to point accordingly.

Alternatives you considered

Putting the files on the air gapped system and changing the links the html to point to the local file system path.

Delengowski commented 4 months ago

I'd like to take the task of making a PR for this but am a little lost on how to best go about funneling it through to ultimately make say a conda package that has this option

godlygeek commented 4 months ago

Honestly, I'm not sure what work is required here either. The biggest part of any PR here is likely figuring out exactly what files are fetched dynamically by our flame graphs as they exist today (using the developer tools of the browser should be able to get us this), and then figuring out what would be involved in vendoring a copy of those into the Memray repo. Once we have a vendored copy of each of those dependencies, it should "just" be a matter of exposing a switch that changes whether our Jinja templates include URLs linking to external resources or include the contents of those resources directly.

If we find that some of these dependencies are difficult to vendor, or have licenses that are incompatible with us vendoring them instead of loading them dynamically, this might be a nonstarter.

vitorespindola commented 1 month ago

Flamegraph report:

Bootstrap - MIT License - https://github.com/twbs/bootstrap/blob/main/LICENSE JQuery - MIT License - https://jquery.org/license Lodash - MIT License - https://lodash.com/license plotly.js - MIT license - https://github.com/plotly/plotly.js/blob/master/LICENSE popper.js(now Floating UI) - MIT License - https://github.com/floating-ui/floating-ui/blob/v2.x/LICENSE.md d3 - ISC License - https://github.com/d3/d3/blob/main/LICENSE d3-flamegraph - Apache License 2.0 - https://github.com/spiermar/d3-flame-graph/blob/master/LICENSE d3-scale-chromatic - Not clear - https://github.com/d3/d3-scale-chromatic/blob/main/LICENSE d3-tip - MIT License - https://github.com/caged/d3-tip/blob/master/LICENSE

Table report:

Datatables - MIT License - https://datatables.net/license/mit