Possible to have Jupyter Book JupyterHub launch integration similar to Binder?

Hi. This is a question about JupyterHub generics and Jupyter Book specifics, so apologizes in advance if this is in the wrong space (I’m happy to have it moved or move the discussion to GitHub Issues).

TLDR: Is it possible to configure a JupyterHub instance with proper authentication so that once can launch into it and have access to pre-loaded data and filestystems in a similar manner to Binder (if those resources were Binderized)? I don’t have access to a JupyterHub instance at the moment so I’m asking here instead of just trying it myself as I figure @choldgraf can probably just tell me yay/nay.

Jupyter Book has launch button integration for different runtimes (Binder, Colab, ThebeLab, and Jupyter Hub). In the hypothetical scenario where you are trying to run a full University physics lab course through Jupyter Book and want to have lab notebooks in Jupyter Book launch into a runtime for students to use, how would you make sure example data is already available to them in the runtime?

  • For the Binder launch button, if you Binderized the whole course Git repo that is also supplying the Jupyter Book this is a non-issue if the data is also in the repo, but it would be a gross abuse to use Binder for a full semester course and you’d like the students to be able to save state/progress.
  • For the Colab launch button, you could have the students manually connect to Google drives to access the example data and then save out their progress to their drive, but that requires all students to have Google accounts and for the runtime to be setup everytime the students want to use it.
  • For the JupyterHub launch button, can this be configured so that a private Jupyter Hub instance can be being a single sign-on, but the example data resources for the course are already available in the correct path for students to be able to use? So like the Binder example with state?

This might be poorly phrased and/or laid out. I’m more than happy to try to clarify any of this and provide a toy example as well.

So is the workflow you intend that:

  • you have a student reading a Jupyter Book;
  • they click a button and go to a JupyterHub site;
  • they log in (or are pre-authed from credentials from the Jupyter Book site?) to run and edit files, and save their updates;
  • at a later time, when they are using Jupyter Book again, they can click the button again, log back into their account on the JupyterHub server, and see the files they changed previously?

If you are running TLJH (The Littlest JupyterHub), you could build a container from the repo used to build the JupyterBook using https://github.com/plasmabio/tljh-repo2docker and then let students log in to the server and select that environment. All you’d need would be a link from the Jupyter Book to the TLJH environment.

4 Likes

@psychemedia Yes, that workflow you describe is basically what I had in mind.

If you are running TLJH (The Littlest JupyterHub), you could build a container from the repo used to build the JupyterBook using GitHub - plasmabio/tljh-repo2docker: Plugin for The Littlest JupyterHub to build multiple user environments with repo2docker and then let students log in to the server and select that environment.

That sounds great. Thanks!

Hmm - are you imagining doing this once for the JupyterHub, or do you want users to create these environments on-the-fly from other environments?

If it’s the former, JupyterHubs are set up all the time to do this. You can set up a jupyterhub to have a certain set of files in locations, security tokens etc to access files remotely, notebooks etc pre-loaded, etc. There’s a lot of flexibility there.

If you want more like ‘on-the-fly jupyterhub that is spun up Binder-style from a github repository’, I’d check out the link @psychemedia shared above. ping also to @yuvipanda who I believe was interested in this idea

2 Likes

Just once, with the ability to edit them. So we would want to create a Physics 123 course environment on the Jupyter Hub that would contain all the Python libraries that they would reasonably need to do their physics labs (basically just the common SciPy stack) and then have example data and the lab instructions and questions available as a notebook that they would then fill in as they work.

Perfect! :smiley: Thanks!