Skip to content

Conversation

linev
Copy link
Member

@linev linev commented Sep 24, 2025

Up to now plain json code embed into ipython notebooks.
This is very inefficient and can make notebook huge.
Especially because of fact that notebook stored as json - so any double-quote " symbol should be escaped.

Therefore use standard compression function of ROOT and then base64 encoding to produce string suitable for embeding. This done in TBufferJSON::zipJSON() method.

On JSROOT side just provide correspondent unzipJSON() function.

And modify jupyter utils.py code to use such functionality.

@linev linev self-assigned this Sep 24, 2025
@linev linev requested a review from guitargeek September 24, 2025 12:43
@linev linev marked this pull request as draft September 24, 2025 12:43
@linev
Copy link
Member Author

linev commented Sep 24, 2025

Copy link

github-actions bot commented Sep 24, 2025

Test Results

    20 files      20 suites   3d 16h 23m 54s ⏱️
 3 678 tests  3 678 ✅ 0 💤 0 ❌
71 768 runs  71 768 ✅ 0 💤 0 ❌

Results for commit 47e762b.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for implementing this so quickly!

Also it's good that you used zlib for the compression, as ROOT is always guaranteed to include this compression library (either via builtin_zlib or not). So it should be possible to display notebooks produced with any build configuration of ROOT with any other build configuration.

@linev
Copy link
Member Author

linev commented Sep 25, 2025

Any supported compression algorithm can be used here.
For the moment I specify kZLIB, but it can be any.

It idea to provide string which can be embed in any JavaScript
code and then unzipped whith JSROOT.unzipJSON function.

Primary aim is to improve json handling in jupyter
Use TBufferJSON.zipJSON method.
dev version of JSROOT has to be used to be able
unpack such string.
1. Introduce unzipJSON for processing zip strings
2. Better detect div layout when creating canvas svg element
3. Fix minor latex problem
4. Detect default histogram in TGraph to correctly set ranges then
@linev linev marked this pull request as ready for review September 25, 2025 10:44
@linev linev merged commit 4ccaaec into root-project:master Sep 26, 2025
43 of 48 checks passed
@linev linev deleted the notebook_zipped branch September 26, 2025 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants