jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.15k stars 950 forks source link

Static widgets #16

Closed jdfreder closed 7 years ago

jdfreder commented 9 years ago

Depends on #13

Originally planned for 3.0, static widgets allow widgets to be exported using nbconvert. The mechanism of state storage has yet to be decided.

stsievert commented 9 years ago

+1. If I'm interpreting correctly, it's a widget that you can embed on any webpage/get raw HTML. I would love to see this and am currently using the unsupported ipywidgets.

TMorville commented 9 years ago

+1. Using Nbconvert or Nbviewer with widgets would be neat feature for teaching people without access to ipython/jupyter.

michaelaye commented 8 years ago

I'm confused, is it correct that currently nothing like this on Jake's blog is possible with the official ipywidgets? https://jakevdp.github.io/blog/2013/12/05/static-interactive-widgets/

bcordo commented 8 years ago

@michaelaye did you confirm? Also looking for something with the same functionality.

bcordo commented 8 years ago

This looks great guys btw. Looking forward!

kulla commented 8 years ago

+1

desilinguist commented 8 years ago

+1

georgebv commented 8 years ago

https://github.com/jakevdp/ipywidgets-static The problem is solved here, though native widgets look much batter. Is anyone working on this right now?

GandaG commented 8 years ago

@georgebv You can tell from his own example that it no longer works. Would absolutely love to see this feature though!

sripakpa commented 8 years ago

+1

sripakpa commented 8 years ago

How is the feature described in this ticket related/different from the feature to have interactive widgets embedded into static web pages illustrated here?

georgebv commented 8 years ago

The point is not having widgets in the static web page. It is about making them interact with the output (by storing all the possible output combinations in the html file).

damianavila commented 8 years ago

I know @SylvainCorlay is going to write something (post) about this soon, see this comment: https://github.com/ipython/ipywidgets/issues/758#issuecomment-246200132

rtbs-dev commented 8 years ago

@damianavila I will be watching this; I have a reveal.js presentation .html file and would like an interactive slider/plot combination to be usable on my static site as opposed to only while using RISE.

jbednar commented 7 years ago

@SylvainCorlay, can you confirm whether there will soon be static export of ipywidgets? We're at this very moment trying to find a different widget library so that we can switch to it for that feature alone, but if we should be staying with ipywidgets and just need to hold on for a few days longer, please let us know!

SylvainCorlay commented 7 years ago

Yes! There is already. For example on http://jupyter.org/widgets, widgets are live.

With 6.0 in a few days, widgets will also be embeddable in sphinx documentation.

Nbconvert will follow.

jbednar commented 7 years ago

Great, thanks! The live widgets at that link are great, but none of those are for the standard sliders, selection boxes, text entry boxes, etc. that we are using ipywidgets for. Presumably those are also now supported? Nbconvert is indeed my main use case, but we can probably work with Sphinx if that's the only currently supported way.

SylvainCorlay commented 7 years ago

All of these are supported. The widgets in that page are built upon ipywidgets. I will add a tab with some simple dropdowns and buttons.

We have had static widgets since 5.0. The nbconvert part is the only reason why this issue is not closed yet.

jbednar commented 7 years ago

Sounds great. Getting nbconvert support is crucial for people even to know that static support is available. Presumably documentation is also needed before closing the issue?

SylvainCorlay commented 7 years ago

Yes. We are currently formalizing the spec for the format of the serialized widgets. cf #901

jbednar commented 7 years ago

With the goal of serialization being to generate and insert that HTML snippet directly, without user cutting and pasting? That does sound crucial for this to be usable in practice, thanks.

SylvainCorlay commented 7 years ago

I don't understand your question, but the html snippet feature will remain for those who want to embed in webpages, blogs.

The nbconvert question is more about the choice of how the widget state is stored in the notebook format.

jbednar commented 7 years ago

I just mean that nbconvert converts .ipynb to .html, and presumably when one does so one won't need to paste in the HTML snippets that create the widgets, by hand? Basically I just want the widgets to be preserved in the exported file, with the values they had at that time as their starting point, whether or not they are hooked up to anything that actually does something in the exported HTML. E.g. here's an example of a bunch of ipywidgets generated with static PNGs using nbconvert: https://anaconda.org/jbednar/paramnb/notebook

But that only works because of the embedded PNGs, whereas embedding the actual widgets would be so much cleaner. Basically I just want to be able to save things as .html and have it all work, insofar as it is possible. Perhaps @philippjfr and @jlstevens could explain better.

SylvainCorlay commented 7 years ago

👍 got that. Stay tuned. :) We are currently sprinting to get these things out.

jbednar commented 7 years ago

Fabulous! I'll hand you a drink as you sprint by, if I see you!

jbednar commented 7 years ago

How is the sprint coming? You guys must be winded by now if you've been running flat out for this long! :-)

SylvainCorlay commented 7 years ago

@jbednar

jbednar commented 7 years ago

That sounds great. Can't wait!

michaelaye commented 7 years ago

Very nice. Just a quickie: i assume the readthedocs version is not yet working because of some final tweaks or am I maybe missing a plugin (using Safari on 10.11.6)? screenshot 2016-12-09 10 20 59

SylvainCorlay commented 7 years ago

Indeed, stay tuned for the rtd rendering.

SylvainCorlay commented 7 years ago

Widgets are rendering in RTD http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html

akhmerov commented 7 years ago

Wow, nice! Out of curiousity, what is the chosen mechanism for state storage?

SylvainCorlay commented 7 years ago

@akhmerov check out the section of the documentation on embedding that got improved at the same time.

http://ipywidgets.readthedocs.io/en/latest/embedding.html

michaelaye commented 7 years ago

Looks great! But: The linked widgets are not linked in RTD: http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Basics.html#Linking-two-similar-widgets Want a new GH issue for that?

SylvainCorlay commented 7 years ago

@michaelaye anything that requires a roundtrip to the backend will not work.

However, jslink and jsdlink do work on RTD.

SylvainCorlay commented 7 years ago

@michaelaye for things that require a kernel, we are thinking of using mybinder as a kernel provider (without the notebook) for embedded widgets. I got some example working but the documentation would probably not be the main purpose.

SylvainCorlay commented 7 years ago

We now support widgets rendering on nbviewer

Example here: http://nbviewer.jupyter.org/github/ipython/ipywidgets/blob/master/docs/source/examples/Widget%20Events.ipynb

This requires the widgets to be generated from the ipywidgets 6.0 (beta) or the current state of master and will be included in the next release.

SylvainCorlay commented 7 years ago

Really really glad to close this issue. Support of custom widgets and some css glitches will be worked on before the 6.0.

Thank you to everyone involved, especially @minrk @michaelpacer @jasongrout @takluyver @jdfreder.

inodb commented 7 years ago

@SylvainCorlay Great stuff! Thanks so much for your work on this!

One question: in the nbviewer link at the top if I click on the button or hit enter in the submit field nothing happens. Is that expected? Thanks!

SylvainCorlay commented 7 years ago

Yes. In these static embeddings, there is no python backend. Only the pure js things will work.

We are also working on a kernel-backed thing for full fledges apps.

inodb commented 7 years ago

Gotcha! One more question: Is it possible to change plots using a radio button or a slider? Similar to http://nbviewer.jupyter.org/github/jakevdp/ipywidgets/blob/master/example.ipynb#Example-4:-Matplotlib-Figures

dmadeka commented 7 years ago

You can check www.github.com/Bloomberg/bqplot .. its built for doing things like this

----- Original Message ----- From: Ino de Bruijn reply@reply.github.com To: ipywidgets@noreply.github.com CC: subscribed@noreply.github.com At: 21-Dec-2016 14:31:52

Gotcha! One more question: Is it possible to change plots using a radio button or a slider? Similar to http://nbviewer.jupyter.org/github/jakevdp/ipywidgets/blob/master/example.ipynb#Example-4:-Matplotlib-Figures
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.