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

Convergences w/ Jupyter Book #339

Open
choldgraf opened this issue Aug 6, 2019 · 9 comments
Open

Convergences w/ Jupyter Book #339

choldgraf opened this issue Aug 6, 2019 · 9 comments

Comments

@choldgraf
Copy link
Contributor

I think there are probably some ways in which Voila and Jupyter Book can overlap in their code - they have similar outputs and goals!

Right now, Jupyter Book is using a very simple template file (https://github.com/jupyter/jupyter-book/blob/master/jupyter_book/book_template/scripts/templates/html.tpl) to generate HTML for each notebook. That HTML is then bundled into a "book" with Jekyll.

I think the single-page HTML output at least could be heavily overlapping or inspired by Voila. The main difference I think is that the jupyter book pages don't have a head or any libraries loaded etc (that is done by Jekyll).

Another use case that Jupyter Book will probably end up supporting is single-page HTML output (basically something like jupyter-book page myfile.ipynb and it'd output a single HTML file or PDF that is clickable). That seems much closer to what Voila already does, so I wonder if there's a way to make the two libraries overlap somewhat.

Lemme know what y'all think!

@maartenbreddels
Copy link
Member

I think it's much closer to nbconvert than voila (since there is no kernel right?), and with jupyter/nbconvert#1056 it may be that the template will live as nbconvert template, that voila will also pick up (in the future jupyter/nbconvert#1056).

@choldgraf
Copy link
Contributor Author

yep I agree that jupyter book is much more nbconvert than it is voila - I just wanna put a pin in this topic in case there comes a point where it makes sense to think strategically about the build system of these two projects. My goal with Jupyter Book is to use as close to the vanilla jupyter templates as possible.

One place that could use some coordination is if JB or Voila start doing make things that utilize cell tags or notebook metadata. For common operations (e.g. hide this cell, etc), it would reduce redundancies if we agreed on a standard tag spec to follow

@jtpio
Copy link
Member

jtpio commented Oct 2, 2019

For reference, this is something we briefly talked about in the last Voila public call: https://voila-dashboards.github.io/2019/09/30/weekly.html

@choldgraf
Copy link
Contributor Author

Nice - I agree that the new templating engine is relevant to Jupyter Book, let me know when there's a good time for me to interface on that (if anything just to try it out with the JB codebase and provide feedback)

@maartenbreddels
Copy link
Member

Will do!

@firasm
Copy link

firasm commented May 28, 2020

hey folks, a few colleagues and I teaching data science at UBC are considering moving to Jupyter Books (thanks @choldgraf and co.!) for our lecture notes and worksheets (previously in jupyter notebooks).

One major gap for us in JupyterBooks at the moment, is interactivity within a jupyterbook using slider bars/buttons to control output. I first (naively) tried ipywidgets which works great locally:

wid

But of course, won't work on a rendered jupyterbook because there's no kernel (you just get a static plot).

Screen Shot 2020-05-28 at 9 16 19 AM

I know I can send students off to a binder notebook but then I might as well ask them to do it locally - the "magic' of having everything in one place on the same page is just so close...

Then I wondered whether Voila could somehow be integrated into jupyterbook and landed on this issue here.

All this is to ask: I wonder if the particular use-case above is something the two (Jupyter Book and Voila) teams have considered?

This would truly be a god-send from a teaching and pedagogy perspective and if I could just get this one last thing working, we can ditch notebooks all together.

P.S. I know some of this functionality can be achieved with plotly and/or Altair, but it's not just this case - there are several other reasons to want an interactive code cell within an HTML page.

@choldgraf
Copy link
Contributor Author

@firasm have you checked out Thebelab? I think that it could be used for your particular case (and has early support in jupyter book: https://jupyterbook.org/interactive/launchbuttons.html#live-interactive-pages-with-thebelab).

The challenge is running and connecting to the kernel, which I think will be tricky as along as you're hosting a static website (vs. something like Voila, which tends to come with a back-end that's already connected).

To your more general point, I'm definitely interested in finding ways that we can power interactivity in "static" sites with voila/jupyter-book/etc

@TomasBeuzen
Copy link

Thanks @choldgraf for the info - makes sense. One thing I'm going to explore for getting somewhat close to @firasm's suggestion is to automatically trigger Thebelab on page load (and get some cells running right away with the helpful thebelab-init tag).

@firasm
Copy link

firasm commented May 28, 2020

Interesting! Actually I have tried it with running code snippets (and it works great!), but I hadn't thought to try it with ipywidgets! Will give it a shot and report back! Good idea...

In the meantime, for anyone else seeing this, Altair works out of the box with buttons and dropdown etc...
Screen Shot 2020-05-28 at 9 36 35 AM

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

No branches or pull requests

5 participants