Skip to content

Commit

Permalink
Merge pull request #139 from yuvipanda/labextensions
Browse files Browse the repository at this point in the history
Install jupyterhub extension for jupyterlab
  • Loading branch information
betatim committed Aug 14, 2018
2 parents 4167526 + 214d8e9 commit 86227f2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
11 changes: 10 additions & 1 deletion integration-tests/test_extensions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import subprocess


Expand Down Expand Up @@ -39,4 +40,12 @@ def test_nbextensions():
assert '{} \x1b[32m enabled \x1b[0m'.format(e) in proc.stdout.decode()

# 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)
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')
15 changes: 15 additions & 0 deletions tljh/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 86227f2

Please sign in to comment.