-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
🤖 hack together output retention in notebooks #105
Conversation
Codecov Report
@@ Coverage Diff @@
## main #105 +/- ##
==========================================
- Coverage 97.94% 97.63% -0.31%
==========================================
Files 10 10
Lines 777 804 +27
==========================================
+ Hits 761 785 +24
- Misses 16 19 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. |
@jonasvdd, if you're not keen on adding kaleido as dependency I can look into serializing the figure into html and render this instead when the dash app is not reachable |
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.
LGTM, just the kaleido and the docs, but the latter can be tackled in #104
pyproject.toml
Outdated
@@ -18,6 +18,8 @@ orjson = "^3.6.8" # faster json serialization | |||
pandas = "^1.3.5" | |||
trace-updater = ">=0.0.8" | |||
numpy = ">=1.21.0" | |||
Flask-Cors = "^3.0.10" | |||
kaleido = "0.2.1" |
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.
Can this be made optional?
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.
The only places we interact with kaleido
is in pyproject.toml
(and the underlying plotly code). So this can be made optional i.m.o. and we should just document this properly in our docs. #104
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.
added it as a dev dependency and updated the docs of the FigureResampler.show_dash
This PR does;
FigureResampler
when notebook is disconnectedLook more into;
_ipython_display_
forFigureResampler
? @jonasvddHow does this work;
This PR adds additional JavaScript code to the
IPython.display.display
method, which contains a base64 bytarray image of the shown figure. When the dash app is not reachable, the image is shown instead of the iframe (which embedded the connected dash app). This works because the JavaScript in the notebook output cells gets executed each time a notebook is loaded (:exclamation: the kernel should not be running for this to happen).How is this implemented;
We create a
JupyterDash
subclass which extends the "inline" visualization capabilities with the functionality described above.This extension is triggered when *"inline_persistent" *is used in the
FigureResampler.show_dash
method_uid
to each object_uid
Note that this is the only CORS endpoint of the JupyterDash app & is only preset when "inline_persistent" is used!