mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-14 21:42:57 +00:00
Default to JupyterLab
Introduce a new `JUPYTER_CMD` option
This commit is contained in:
1
Makefile
1
Makefile
@@ -128,7 +128,6 @@ cont-rm-all: ## remove all containers
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
dev/%: DARGS?=-e JUPYTER_ENABLE_LAB=yes
|
|
||||||
dev/%: PORT?=8888
|
dev/%: PORT?=8888
|
||||||
dev/%: ## run a foreground container for a stack
|
dev/%: ## run a foreground container for a stack
|
||||||
docker run -it --rm -p $(PORT):8888 $(DARGS) $(OWNER)/$(notdir $@)
|
docker run -it --rm -p $(PORT):8888 $(DARGS) $(OWNER)/$(notdir $@)
|
||||||
|
@@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# The Jupyter command to launch
|
||||||
|
# JupyterLab by default
|
||||||
|
JUPYTER_CMD="${JUPYTER_CMD:=lab}"
|
||||||
|
|
||||||
if [[ -n "${JUPYTERHUB_API_TOKEN}" ]]; then
|
if [[ -n "${JUPYTERHUB_API_TOKEN}" ]]; then
|
||||||
echo "WARNING: using start-singleuser.sh instead of start-notebook.sh to start a server associated with JupyterHub."
|
echo "WARNING: using start-singleuser.sh instead of start-notebook.sh to start a server associated with JupyterHub."
|
||||||
exec /usr/local/bin/start-singleuser.sh "$@"
|
exec /usr/local/bin/start-singleuser.sh "$@"
|
||||||
@@ -15,10 +19,8 @@ if [[ "${RESTARTABLE}" == "yes" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${JUPYTER_ENABLE_LAB}" ]]; then
|
if [[ -n "${JUPYTER_ENABLE_LAB}" ]]; then
|
||||||
# shellcheck disable=SC1091,SC2086
|
|
||||||
exec /usr/local/bin/start.sh ${wrapper} jupyter lab ${NOTEBOOK_ARGS} "$@"
|
|
||||||
else
|
|
||||||
echo "WARNING: Jupyter Notebook deprecation notice https://github.com/jupyter/docker-stacks#jupyter-notebook-deprecation-notice."
|
echo "WARNING: Jupyter Notebook deprecation notice https://github.com/jupyter/docker-stacks#jupyter-notebook-deprecation-notice."
|
||||||
# shellcheck disable=SC1091,SC2086
|
|
||||||
exec /usr/local/bin/start.sh ${wrapper} jupyter notebook ${NOTEBOOK_ARGS} "$@"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091,SC2086
|
||||||
|
exec /usr/local/bin/start.sh ${wrapper} jupyter ${JUPYTER_CMD} ${NOTEBOOK_ARGS} "$@"
|
||||||
|
@@ -23,8 +23,7 @@ def test_cli_args(container: TrackedContainer, http_client: requests.Session) ->
|
|||||||
warnings = [
|
warnings = [
|
||||||
warning for warning in logs.split("\n") if warning.startswith("WARNING")
|
warning for warning in logs.split("\n") if warning.startswith("WARNING")
|
||||||
]
|
]
|
||||||
assert len(warnings) == 1
|
assert not warnings
|
||||||
assert warnings[0].startswith("WARNING: Jupyter Notebook deprecation notice")
|
|
||||||
assert "login_submit" not in resp.text
|
assert "login_submit" not in resp.text
|
||||||
|
|
||||||
|
|
||||||
@@ -49,8 +48,7 @@ def test_unsigned_ssl(
|
|||||||
warnings = [
|
warnings = [
|
||||||
warning for warning in logs.split("\n") if warning.startswith("WARNING")
|
warning for warning in logs.split("\n") if warning.startswith("WARNING")
|
||||||
]
|
]
|
||||||
assert len(warnings) == 1
|
assert not warnings
|
||||||
assert warnings[0].startswith("WARNING: Jupyter Notebook deprecation notice")
|
|
||||||
|
|
||||||
|
|
||||||
def test_uid_change(container: TrackedContainer) -> None:
|
def test_uid_change(container: TrackedContainer) -> None:
|
||||||
|
@@ -11,10 +11,14 @@ LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"env,expected_server",
|
"env,expected_server,expected_warning",
|
||||||
[
|
[
|
||||||
(["JUPYTER_ENABLE_LAB=yes"], "lab"),
|
(["JUPYTER_ENABLE_LAB=yes"], "lab", True),
|
||||||
(None, "notebook"),
|
(None, "lab", False),
|
||||||
|
(["JUPYTER_CMD=lab"], "lab", False),
|
||||||
|
(["JUPYTER_CMD=notebook"], "notebook", False),
|
||||||
|
(["JUPYTER_CMD=server"], "server", False),
|
||||||
|
(["JUPYTER_CMD=nbclassic"], "nbclassic", False),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_start_notebook(
|
def test_start_notebook(
|
||||||
@@ -22,6 +26,7 @@ def test_start_notebook(
|
|||||||
http_client: requests.Session,
|
http_client: requests.Session,
|
||||||
env,
|
env,
|
||||||
expected_server: str,
|
expected_server: str,
|
||||||
|
expected_warning: bool,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the notebook start-notebook script"""
|
"""Test the notebook start-notebook script"""
|
||||||
LOGGER.info(
|
LOGGER.info(
|
||||||
@@ -36,7 +41,7 @@ def test_start_notebook(
|
|||||||
logs = c.logs(stdout=True).decode("utf-8")
|
logs = c.logs(stdout=True).decode("utf-8")
|
||||||
LOGGER.debug(logs)
|
LOGGER.debug(logs)
|
||||||
assert "ERROR" not in logs
|
assert "ERROR" not in logs
|
||||||
if expected_server != "notebook":
|
if not expected_warning:
|
||||||
assert "WARNING" not in logs
|
assert "WARNING" not in logs
|
||||||
else:
|
else:
|
||||||
warnings = [
|
warnings = [
|
||||||
@@ -48,10 +53,6 @@ def test_start_notebook(
|
|||||||
assert (
|
assert (
|
||||||
f"Executing the command: jupyter {expected_server}" in logs
|
f"Executing the command: jupyter {expected_server}" in logs
|
||||||
), f"Not the expected command (jupyter {expected_server}) was launched"
|
), f"Not the expected command (jupyter {expected_server}) was launched"
|
||||||
# Checking warning messages
|
|
||||||
if not env:
|
|
||||||
msg = "WARNING: Jupyter Notebook deprecation notice"
|
|
||||||
assert msg in logs, f"Expected warning message {msg} not printed"
|
|
||||||
|
|
||||||
|
|
||||||
def test_tini_entrypoint(
|
def test_tini_entrypoint(
|
||||||
|
Reference in New Issue
Block a user