-
Notifications
You must be signed in to change notification settings - Fork 948
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
[WIP] Export output widget in embed bundle #1380
Conversation
My initial approach for this is to start developing this is as an independent widget inspired by the jupyterlab output widget, then see how much code can be factored out (and how). |
As a second phase to this, I was imagining that the embedded widget manager could expose an API for adding more rendermime renderers to the jlab output widget as well. |
For the initial approach, I would start by importing the jupyterlab output and rendermime packages and using the jlab output widget directly. It was designed to be usable outside of jlab. |
Thanks so much for taking this on! It's one of the biggest blockers we have for releasing 7.0. |
Thanks -- that answers one of my questions.
Thanks! I expect I'll have several questions along the way. |
Is the intention here to allow users to write custom renderers in the HTML documents in which the widgets are embedded? |
The output widget now displays the content of the model state (at least for very simple states like streams).
For reference, I'm currently using this test rig (I'll add more complex outputs when I have basic ones working): <html>
<head>
<!-- <script src="https://unpkg.com/jupyter-js-widgets@~3.0.0-alpha.6/dist/embed.js"></script> -->
<script src="./embed.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script type="application/vnd.jupyter.widget-state+json">
{
"version_major": 2,
"version_minor": 0,
"state": {
"799936c00fbc4187a4560a5e7a6ed5f4": {
"model_name": "LayoutModel",
"model_module": "jupyter-js-widgets",
"model_module_version": "3.0.0",
"state": {}
},
"1ad16665c76a44908e4c269821dcedbd": {
"model_name": "OutputModel",
"model_module": "jupyter-js-widgets",
"model_module_version": "3.0.0",
"state": {
"_view_module": "jupyter-js-widgets",
"_dom_classes": [],
"msg_throttle": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "hi\n"
}
],
"_model_module_version": "3.0.0",
"_view_count": null,
"_view_module_version": "3.0.0",
"layout": "IPY_MODEL_799936c00fbc4187a4560a5e7a6ed5f4",
"_model_module": "jupyter-js-widgets"
}
}
}
}
</script>
</head>
<body>
<h1>Output embedding example</h1>
<div id="widget-embedded-here">
<script type="application/vnd.jupyter.widget-view+json">
{
"model_id": "1ad16665c76a44908e4c269821dcedbd",
"version_minor": "0",
"version_major": "2"
}
</script>
</div>
</body>
</html> |
This allows outputs with rich displays (like dataframes) to be displayed correctly. Having to amend the main widgets stylesheet to provide something that is normally provided by the notebook or JupyterLab seems inelegant. It may be worth splitting out the embed stylesheet.
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.
Saw your note on the stylesheet. We should really (eventually) split out the entire embed manager into a separate npm package. Perhaps now is a good time to do so?
That makes sense. I'll put in a (separate) tentative PR for splitting out the embed manager into a separate module. |
I'm closing this in favour of #1410 . This has diverged from master sufficiently that it would be harder to merge than to just start again. |
Thanks @pbugnion - we're moving pretty fast in master. |
Prior to this PR, the output widget could not be embedded. Addresses issue #986 .