Merge pull request #139 from yuvipanda/labextensions

Install jupyterhub extension for jupyterlab
This commit is contained in:
Tim Head
2018-08-14 09:09:17 +02:00
committed by GitHub
2 changed files with 25 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import os
import subprocess
@@ -40,3 +41,11 @@ def test_nbextensions():
# Ensure we have 'OK' messages in our stdout, to make sure everything is importable
proc.stderr.decode() == ' - Validating: \x1b[32mOK\x1b[0m\n' * len(extensions)
def test_labextensions():
"""
Validate labextensions we want installed
"""
# Currently we only install jupyterhub
assert os.path.exists('/opt/tljh/user/bin/jupyter-labhub')

View File

@@ -154,6 +154,20 @@ def ensure_jupyterhub_service(prefix):
systemd.enable_service('traefik')
def ensure_jupyterlab_extensions():
"""
Install the JupyterLab extensions we want.
"""
extensions = [
'@jupyterlab/hub-extension'
]
subprocess.check_output([
os.path.join(USER_ENV_PREFIX, 'bin/jupyter'),
'labextension',
'install'
] + extensions)
def ensure_jupyterhub_package(prefix):
"""
Install JupyterHub into our conda environment if needed.
@@ -403,6 +417,7 @@ def main():
ensure_jupyterhub_package(HUB_ENV_PREFIX)
ensure_chp_package(HUB_ENV_PREFIX)
ensure_config_yaml(pm)
ensure_jupyterlab_extensions()
ensure_jupyterhub_service(HUB_ENV_PREFIX)
ensure_jupyterhub_running()
ensure_symlinks(HUB_ENV_PREFIX)