Skip to content
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

Add support for nbinteract #82

Closed
choldgraf opened this issue Jan 14, 2019 · 9 comments · Fixed by #119
Closed

Add support for nbinteract #82

choldgraf opened this issue Jan 14, 2019 · 9 comments · Fixed by #119
Labels
enhancement New feature or request

Comments

@choldgraf
Copy link
Collaborator

A previous version of Jupyter Book added support for nbinteract, an interesting project from @SamLau95 that facilitated interactive visualizations using Binder. It's similar to Thebelab, though focused around creating interactive widgets instead of editable code cells.

I'd like to see Jupyter Book support nbinteract once more - @SamLau95 do you have guidance on the path-of-least-resistance to doing this? I'm thinking:

What do you think?

@SamLau95
Copy link
Collaborator

This sounds good! You've listed all the important steps needed to add nbinteract support. I think adding support won't be hard. Communicating how to add interactivity will be trickier though, since it requires authors to learn the ipywidgets library.

Sadly, my cycles are quite full at the moment. Do you have a timeline in mind @choldgraf ?

@choldgraf
Copy link
Collaborator Author

@SamLau95 what's an example of a notebook that could be used to demo nbinteract? Does it only run the contents of cells and then render the output as widgets? Or does it require a particular notebook configuration etc?

@choldgraf
Copy link
Collaborator Author

If it doesn't require any special notebook setup, then perhaps some of the rendering could be offloaded onto Thebelab w/ jupyter-book/thebe#102

@SamLau95
Copy link
Collaborator

I think this notebook is a useful demo: https://github.com/SamLau95/nbinteract/blob/master/docs/notebooks/examples/examples_sampling_from_a_population.ipynb

Any other notebook in that examples/ folder should also work.

You don't have to modify the notebook at all for nbinteract to work. Instead, you have to load and run the nbinteract JS package on an HTML page with Jupyter cells. For example, this is the code we load in the nbinteract converter: https://github.com/SamLau95/nbinteract/blob/master/nbinteract/templates/partial.tpl

For the Data 100 textbook, we use the following code: https://github.com/DS-100/textbook/blob/master/assets/js/scripts.js#L133-L160

@choldgraf
Copy link
Collaborator Author

ok sounds great - in that case it shouldn't be too hard to get this working, since that's the same pattern that thebelab uses as well.

@choldgraf choldgraf added the enhancement New feature or request label Feb 25, 2019
choldgraf added a commit to choldgraf/jupyter-book that referenced this issue Apr 28, 2020
changing underscore to hyphen for hide and remove tags
@luukalt
Copy link

luukalt commented Dec 17, 2020

Does jupyter book support nbinteract at this moment?
Or is the only way to create interactive html page through thebelab.

@choldgraf
Copy link
Collaborator Author

@luukalt thebelab (now just called thebe) is the way to go 👍 you could try to get nbinteract to manually work but it's not officially supported

@luukalt
Copy link

luukalt commented Dec 21, 2020

Thanks @choldgraf! What should be done to include nbinteract manually (since I like the look way better than thebe)?
I am able to use nbinteract to make a dynamic html of a jupyter notebook. However, a simple copy paste of this html in my jupyterbook does not do the trick (which ofcourse makes sense, since all the other stuff, like menus and sidebars are missing), so I was wondering if there is a simple trick to make the interactive html work in the jupyterbook. Thanks in advance.

@choldgraf
Copy link
Collaborator Author

hmmm - I'm not sure exactly, I'd recommend checking out the docs on custom JS code and try to figure it out from there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants