Merge pull request #928 from jtpio/lab4-nb7

Update Notebook, JupyterLab, Jupyter Resource Usage
This commit is contained in:
Erik Sundell
2023-08-09 09:22:58 +02:00
committed by GitHub
2 changed files with 19 additions and 19 deletions

View File

@@ -1,3 +1,4 @@
import re
import subprocess import subprocess
@@ -7,13 +8,13 @@ def test_serverextensions():
""" """
# jupyter-serverextension writes to stdout and stderr weirdly # jupyter-serverextension writes to stdout and stderr weirdly
proc = subprocess.run( proc = subprocess.run(
["/opt/tljh/user/bin/jupyter-serverextension", "list", "--sys-prefix"], ["/opt/tljh/user/bin/jupyter-server", "extension", "list", "--sys-prefix"],
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
) )
extensions = [ extensions = [
"jupyterlab 3.", "jupyterlab",
"nbgitpuller 1.", "nbgitpuller",
"jupyter_resource_usage", "jupyter_resource_usage",
] ]
@@ -21,27 +22,26 @@ def test_serverextensions():
assert e in proc.stderr.decode() assert e in proc.stderr.decode()
def test_nbextensions(): def test_labextensions():
""" """
Validate nbextensions we want are installed & enabled Validate JupyterLab extensions we want are installed & enabled
""" """
# jupyter-nbextension writes to stdout and stderr weirdly # jupyter-labextension writes to stdout and stderr weirdly
proc = subprocess.run( proc = subprocess.run(
["/opt/tljh/user/bin/jupyter-nbextension", "list", "--sys-prefix"], ["/opt/tljh/user/bin/jupyter-labextension", "list"],
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
) )
extensions = [ extensions = [
"jupyter_resource_usage/main", "@jupyter-server/resource-usage",
# This is what ipywidgets nbextension is called # This is what ipywidgets lab extension is called
"jupyter-js-widgets/extension", "@jupyter-widgets/jupyterlab-manager",
] ]
for e in extensions: for e in extensions:
assert f"{e} \x1b[32m enabled \x1b[0m" in proc.stdout.decode() # jupyter labextension lists outputs to stderr
out = proc.stderr.decode()
# Ensure we have 'OK' messages in our stdout, to make sure everything is importable enabled_ok_pattern = re.compile(rf"{e}.*enabled.*OK")
assert proc.stderr.decode() == " - Validating: \x1b[32mOK\x1b[0m\n" * len( matches = enabled_ok_pattern.search(out)
extensions assert matches is not None
)

View File

@@ -8,11 +8,11 @@
# the requirements-txt-fixer pre-commit hook that sorted them and made # the requirements-txt-fixer pre-commit hook that sorted them and made
# our integration tests fail. # our integration tests fail.
# #
notebook==6.* notebook==7.*
jupyterlab==3.* jupyterlab==4.*
# nbgitpuller for easily pulling in Git repositories # nbgitpuller for easily pulling in Git repositories
nbgitpuller==1.* nbgitpuller==1.*
# jupyter-resource-usage to show people how much RAM they are using # jupyter-resource-usage to show people how much RAM they are using
jupyter-resource-usage==0.7.* jupyter-resource-usage==1.*
# Most people consider ipywidgets to be part of the core notebook experience # Most people consider ipywidgets to be part of the core notebook experience
ipywidgets==8.* ipywidgets==8.*