Skip to content

Commit 91d221c

Browse files
authored
Issue 404: Install TOC extension by default (#721)
* install TOC extension and nbconfigurator by default
1 parent 3a4d853 commit 91d221c

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

automation/src/test/scala/org/broadinstitute/dsde/workbench/leonardo/NotebookInstallSpec.scala

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class NotebookInstallSpec extends ClusterFixtureSpec {
1717
|bx.bitset.sys.copyright""".stripMargin
1818

1919
notebookPage.executeCell("1+1") shouldBe Some("2")
20-
notebookPage.executeCell(getPythonVersion) shouldBe Some("3.6.7")
20+
notebookPage.executeCell(getPythonVersion) shouldBe Some("3.6.8")
2121
notebookPage.executeCell(getBxPython).get should include("Copyright (c)")
2222
}
2323
}
@@ -76,6 +76,20 @@ class NotebookInstallSpec extends ClusterFixtureSpec {
7676
}
7777
}
7878

79-
}
79+
"should install Table of Content from jupyter_contrib_nbextensions" in { clusterFixture =>
80+
withWebDriver { implicit driver =>
81+
withNewNotebook(clusterFixture.cluster) { notebookPage =>
82+
notebookPage.executeCell("! jupyter nbextension list").get should include("toc2/main enabled")
83+
}
84+
}
85+
}
8086

87+
"should install and enable nbextensions_configurator" in { clusterFixture =>
88+
withWebDriver { implicit driver =>
89+
withNewNotebook(clusterFixture.cluster) { notebookPage =>
90+
notebookPage.executeCell("! jupyter serverextension list ").get should include("jupyter_nbextensions_configurator enabled")
91+
}
92+
}
93+
}
94+
}
8195
}

docker/jupyter/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ RUN apt-get update \
206206
&& pip3 install matplotlib-venn==0.11.5 \
207207
# for jupyter_localize_extension
208208
&& pip3 install python-datauri \
209+
&& pip3 install jupyter_contrib_nbextensions \
210+
&& pip3 install jupyter_nbextensions_configurator \
209211
&& apt-get clean \
210212
&& rm -rf /var/lib/apt/lists/*
211213

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
# installs jupyter_contrib_nbextensions https://github.com/ipython-contrib/jupyter_contrib_nbextensions
5+
# also installs the jupyter_nbextensions_configurator https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator
6+
sudo -E -u jupyter-user jupyter nbextensions_configurator enable --user
7+
sudo -E -u jupyter-user jupyter contrib nbextension install --user
8+
sudo -E -u jupyter-user jupyter nbextension enable toc2/main

src/main/resources/jupyter/init-actions.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ if [[ "${ROLE}" == 'Master' ]]; then
247247
done
248248
fi
249249

250+
251+
retry 3 docker exec -u root -e PIP_USER=false ${JUPYTER_SERVER_NAME} ${JUPYTER_SCRIPTS}/extension/install_jupyter_contrib_nbextensions.sh
252+
250253
# If a custom.js was specified, copy it into the jupyter docker container.
251254
if [ ! -z ${JUPYTER_CUSTOM_JS_URI} ] ; then
252255
log 'Installing Jupyter custom.js...'

0 commit comments

Comments
 (0)