Skip to content

Commit f3109e0

Browse files
committed
pick lab ui by default, only if lab 3 is available
fully overrideable with singleuser.cmd, singleuser.defaultUrl
1 parent 69833c2 commit f3109e0

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

helm-chart/binderhub/values.yaml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,29 @@ jupyterhub:
188188
admin: true
189189
apiToken:
190190
singleuser:
191-
# start jupyter notebook for the server
192-
cmd: jupyter-notebook
193-
# use jupyterlab for the default UI
194-
defaultUrl: /lab
191+
# start notebook server with lab ui as default
192+
# *if available*
193+
cmd:
194+
- python3
195+
- "-c"
196+
- |
197+
import os
198+
import sys
199+
200+
try:
201+
import jupyterlab
202+
major = int(jupyterlab.__version__.split(".", 1)[0])
203+
except Exception:
204+
have_lab = False
205+
else:
206+
have_lab = major >= 3
207+
208+
if have_lab and "NotebookApp.default_url" not in " ".join(sys.argv):
209+
# if recent-enough lab is available, make it the default UI
210+
sys.argv.insert(1, "--NotebookApp.default_url=/lab/")
211+
212+
# launch the notebook server
213+
os.execvp("jupyter-notebook", sys.argv)
195214
events: false
196215
storage:
197216
type: none
@@ -282,4 +301,3 @@ podAnnotations: {}
282301

283302
# Deprecated values, kept here so we can provide useful error messages
284303
cors: {}
285-

0 commit comments

Comments
 (0)