Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Notebook, JupyterLab, Jupyter Resource Usage #928

Merged
merged 12 commits into from
Aug 9, 2023
32 changes: 16 additions & 16 deletions integration-tests/test_extensions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import subprocess


Expand All @@ -7,41 +8,40 @@ def test_serverextensions():
"""
# jupyter-serverextension writes to stdout and stderr weirdly
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,
)

extensions = [
"jupyterlab 3.",
"nbgitpuller 1.",
"jupyterlab",
"nbgitpuller",
"jupyter_resource_usage",
]

for e in extensions:
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(
["/opt/tljh/user/bin/jupyter-nbextension", "list", "--sys-prefix"],
["/opt/tljh/user/bin/jupyter-labextension", "list"],
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
)

extensions = [
"jupyter_resource_usage/main",
# This is what ipywidgets nbextension is called
"jupyter-js-widgets/extension",
"@jupyter-server/resource-usage",
# This is what ipywidgets lab extension is called
"@jupyter-widgets/jupyterlab-manager",
]

for e in extensions:
assert f"{e} \x1b[32m enabled \x1b[0m" in proc.stdout.decode()

# Ensure we have 'OK' messages in our stdout, to make sure everything is importable
assert proc.stderr.decode() == " - Validating: \x1b[32mOK\x1b[0m\n" * len(
extensions
)
# jupyter labextension lists outputs to stderr
out = proc.stderr.decode()
enabled_ok_pattern = re.compile(rf"{e}.*enabled.*OK")
matches = enabled_ok_pattern.search(out)
assert matches is not None
6 changes: 3 additions & 3 deletions tljh/requirements-user-env-extras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
# the requirements-txt-fixer pre-commit hook that sorted them and made
# our integration tests fail.
#
notebook==6.*
jupyterlab==3.*
notebook==7.*
jupyterlab==4.*
# nbgitpuller for easily pulling in Git repositories
nbgitpuller==1.*
# 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
ipywidgets==8.*