-
Notifications
You must be signed in to change notification settings - Fork 421
Add --no-web to flamegraph reporters #790
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
Conversation
Thank you taking this on Pablo. I was just revisiting it to tackle while on vacation from work, and was looking at how other projects like Plotly Dash do this. So the plan is to just vendor all the JavaScript script but conditionally use it. I thought the project may have wanted to just make a separate wheel build option to vendor if specified. This seems easier. |
0f56a66
to
0af1074
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #790 +/- ##
==========================================
+ Coverage 92.05% 92.11% +0.06%
==========================================
Files 95 95
Lines 11946 11953 +7
Branches 411 412 +1
==========================================
+ Hits 10997 11011 +14
+ Misses 949 942 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed two small fixups, but otherwise this LGTM.
This is much, much simpler than I was afraid this feature would be!
This commit introduces the infrastructure needed to bundle external CDN dependencies as local assets for offline use. The package.json now includes all necessary vendor dependencies including Bootstrap, jQuery, D3, DataTables, and Plotly.js. The webpack configuration has been updated with CopyWebpackPlugin to automatically copy minified assets from node_modules to a local vendor directory during the build process. The Makefile has been enhanced with new targets: build-vendor creates the vendor assets, the main build target now includes vendor asset generation, and the clean target removes the vendor directory. This build system enables the upcoming --no-web flag functionality that allows memray to generate HTML reports that work without internet access. Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
This commit adds all the pre-built vendor assets that were copied from node_modules during the build process. The vendor directory now contains minified versions of Bootstrap CSS and JavaScript, jQuery, Popper.js, Lodash, and Plotly.js for the base functionality. For flamegraph support, it includes the complete D3 v4 library along with d3-scale-chromatic, d3-tip, and d3-flame-graph extensions. DataTables libraries are included for table report functionality. All assets are production-ready minified versions that match the exact versions previously loaded from CDNs. The package-lock.json has been updated to reflect the new dependency tree. These bundled assets will be used when the --no-web flag is specified, ensuring that memray can generate fully functional HTML reports on systems without internet connectivity. Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
This commit implements the --no-web flag that allows memray to generate HTML reports that work without internet access. The flag has been added to both the flamegraph and table commands, and the flag value is passed through the entire rendering pipeline from the command parsers to the template engine. The HTML templates have been updated to conditionally include assets based on the no_web flag. When the flag is not specified, templates continue to use CDN links for optimal performance and faster loading. When --no-web is specified, templates instead inline the locally bundled vendor assets using the include_file template function. This ensures that generated reports are completely self-contained and functional on airgapped systems. The BaseReporter protocol and all reporter implementations have been updated to accept the no_web parameter, maintaining backward compatibility while enabling the new offline functionality. This change addresses the need for memray to work in environments without internet connectivity, as requested in issue bloomberg#470. Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Add news entry Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Closes: #470