File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff 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
284303cors : {}
285-
You can’t perform that action at this time.
0 commit comments