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

WIP: Switch to nbclassic #479

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"variable": {
"PYTHON_VERSION": {
"default": "3.9.13"
"default": "3.11.4"
},
"PGSQL_VERSION": {
"default": "15"
Expand Down
2 changes: 1 addition & 1 deletion stack/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ENV PIP_USER 1

# Upgrade pip and mamba to latest
# Install aiida-core and other shared requirements.
RUN mamba update -y pip && \
RUN mamba update -y pip zstandard && \
mamba install --yes \
aiida-core==${AIIDA_VERSION} \
mamba-bash-completion \
Expand Down
23 changes: 9 additions & 14 deletions stack/lab/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ FROM base
LABEL maintainer="AiiDAlab Team <[email protected]>"

# By default, Jupyter Docker image launches the JupyterLab interface.
# Here, we change it to the classic Jupyter Notebook which is used by AiiDAlab.
# In the future, we might want to switch to other options such as `nbclassic` or `retro`,
# but the `nbclassic` is not supported because of appmode.
# see: https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#switching-back-to-the-classic-notebook-or-using-a-different-startup-command
ENV DOCKER_STACKS_JUPYTER_CMD=notebook
# Here, we change it to the nbclassic Jupyter Notebook which is used by AiiDAlab.
# https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#switching-back-to-the-classic-notebook-or-using-a-different-startup-command
ENV DOCKER_STACKS_JUPYTER_CMD=nbclassic

USER root
WORKDIR /opt/
Expand All @@ -17,6 +15,7 @@ WORKDIR /opt/
ARG AIIDALAB_VERSION
RUN mamba install --yes \
aiidalab=${AIIDALAB_VERSION} \
appmode=1.0.0 \
&& mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
Expand All @@ -38,14 +37,9 @@ RUN git clone https://github.com/aiidalab/aiidalab-home && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Install and enable appmode, turning Jupyter notebooks to Apps
RUN pip install appmode==0.8.0 --no-cache-dir --no-user
# Enable appmode extension
RUN jupyter nbextension enable --py --sys-prefix appmode && \
jupyter serverextension enable --py --sys-prefix appmode

# Swap appmode icon for AiiDAlab gears icon, shown during app load
COPY --chown=${NB_UID}:${NB_GID} gears.svg ${CONDA_DIR}/share/jupyter/nbextensions/appmode/gears.svg
# TODO: What is the correct directory for nbclassic?
#COPY --chown=${NB_UID}:${NB_GID} gears.svg ${CONDA_DIR}/share/jupyter/nbextensions/appmode/gears.svg

# Copy start-up scripts for AiiDAlab.
COPY before-notebook.d/* /usr/local/bin/before-notebook.d/
Expand Down Expand Up @@ -75,7 +69,8 @@ USER ${NB_USER}

WORKDIR "/home/${NB_USER}"

RUN mkdir -p /home/${NB_USER}/apps
RUN mkdir -p /home/${NB_USER}/apps
RUN mkdir -p /home/${NB_USER}/.tmp_notebooks

# When a Jupyter notebook server looses a connection to the frontend,
# it keeps the messages in a buffer. If there is a background thread running
Expand All @@ -89,7 +84,7 @@ RUN mkdir -p /home/${NB_USER}/apps
# more than 12 hours. We also close all inactive terminals after 10 minutes.
ENV NOTEBOOK_ARGS \
"--NotebookApp.default_url='/apps/apps/home/start.ipynb'" \
"--ContentsManager.allow_hidden=True" \
"--Appmode.temp_dir=/home/${NB_USER}/.tmp_notebooks" \
"--MappingKernelManager.buffer_offline_messages=True" \
"--MappingKernelManager.cull_busy=True" \
"--MappingKernelManager.cull_connected=True" \
Expand Down
5 changes: 5 additions & 0 deletions tests/test_aiidalab_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def _generate_aiidalab_install_output(package_name):
if pkg:
app_name = pkg.split("@")[0]
aiidalab_exec(f"aiidalab uninstall --yes --force {app_name}", user=nb_user)
# TODO: Remove this after solving https://github.com/aiidalab/aiidalab/issues/405
pkg_name = app_name
if app_name.lower() == "quantum-espresso":
pkg_name = "aiidalab-qe"
aiidalab_exec(f"pip uninstall --yes {pkg_name}", user=nb_user)


@pytest.mark.parametrize("package_name", ["aiidalab-widgets-base", "quantum-espresso"])
Expand Down