pick lab ui by default, only if lab 3 is available
fully overrideable with singleuser.cmd, singleuser.defaultUrl
@@ -188,10 +188,29 @@ jupyterhub:
admin: true
apiToken:
singleuser:
- # start jupyter notebook for the server
- cmd: jupyter-notebook
- # use jupyterlab for the default UI
- defaultUrl: /lab
+ # start notebook server with lab ui as default
+ # *if available*
+ cmd:
+ - python3
+ - "-c"
+ - |
+ import os
+ import sys
+
+ try:
+ import jupyterlab
+ major = int(jupyterlab.__version__.split(".", 1)[0])
+ except Exception:
+ have_lab = False
+ else:
+ have_lab = major >= 3
+
+ if have_lab and "NotebookApp.default_url" not in " ".join(sys.argv):
+ # if recent-enough lab is available, make it the default UI
+ sys.argv.insert(1, "--NotebookApp.default_url=/lab/")
+
+ # launch the notebook server
+ os.execvp("jupyter-notebook", sys.argv)
events: false
storage:
type: none
@@ -282,4 +301,3 @@ podAnnotations: {}
# Deprecated values, kept here so we can provide useful error messages
cors: {}
-
