New Package (jupyterhub-share): JupyterHub UserOptions Share Button

Hey,

I just wanted to show a small package to make chosen user_options shareable.
When selecting the user_options before starting the jupyter-server, you will find a share icon next to the header. This will generate a short link with a unique id.
If you, or other users, visit this url the user_options will be filled with the previously chosen user_options, instead of the default values.

In combination with Docker Images this may already offer you the possibility to create FAIR digital objects.

Feel free to contribute and improve this small package.

With pip install jupyterhub-share you can use it with this example jupyterhub_config.py:

from jupyterhub.auth import DummyAuthenticator
from jupyterhub.spawner import SimpleLocalProcessSpawner

import jupyterhub_share

c.JupyterHub.authenticator_class = DummyAuthenticator
c.JupyterHub.spawner_class = SimpleLocalProcessSpawner

c.SimpleLocalProcessSpawner.options_form = """
          Choose a system:
          <select name="system">
              <option value="Local">Local</option>
              <option value="Remote-A">Remote A</option>
              <option value="Remote-B">Remote B</option>
          </select>
          <select name="image">
              <option value="a">Image A</option>
              <option value="b">Image B</option>
          </select>
          <input type="checkbox" name="Check02" value="true" checked="true" />
          <input type="checkbox" name="Check01" value="true" />
          <input type="text" name="textf" class="form-control" id="repository" data-lpignore="true" placeholder="GitHub repository name or URL">
          <input type="number" name="runtime-input" value="30" min="10" max="1440" required="required">
          <input type="range" name="range1" min="0" max="100" value="90" step="10" />
      """
c.JupyterHub.default_url = "/hub/home"

import os
c.JupyterHub.template_paths = os.path.join(os.path.dirname(jupyterhub_share.__file__), "share", "templates")

c.JupyterHub.allow_named_servers = True

Source Code: GitHub - kreuzert/jupyterhub-share
Please let me know if you think this might be useful.

2 Likes