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

Removing inkscape package from the minimal-notebook #1765

Merged
merged 22 commits into from
Aug 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions base-notebook/jupyter_server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
c.ServerApp.port = 8888
c.ServerApp.open_browser = False

# to output both image/svg+xml and application/pdf plot formats in the notebook file
c.InlineBackend.figure_formats = {"png", "jpeg", "svg", "pdf"}

# https://github.com/jupyter/notebook/issues/3130
c.FileContentsManager.delete_to_trash = False

Expand Down
5 changes: 3 additions & 2 deletions minimal-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ RUN apt-get update --yes && \
tzdata \
unzip \
vim-tiny \
# Inkscape is installed to be able to convert SVG files
inkscape \
# git-over-ssh
openssh-client \
# less is needed to run help in R
Expand All @@ -40,3 +38,6 @@ RUN update-alternatives --install /usr/bin/nano nano /bin/nano-tiny 10

# Switch back to jovyan to avoid accidental container runs as root
USER ${NB_UID}

# Add R mimetype option to specify how the plot returns from R to the browser
COPY --chown=${NB_UID}:${NB_GID} Rprofile.site /opt/conda/lib/R/etc/
4 changes: 4 additions & 0 deletions minimal-notebook/Rprofile.site
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add R mimetype to specify how the plot returns from R to the browser.
# https://notebook.community/andrie/jupyter-notebook-samples/Changing%20R%20plot%20options%20in%20Jupyter

options(jupyter.plot_mimetypes = c('text/plain', 'image/png', 'image/jpeg', 'image/svg+xml', 'application/pdf'))
21 changes: 21 additions & 0 deletions tests/R_mimetype_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import logging

from tests.conftest import TrackedContainer

LOGGER = logging.getLogger(__name__)


def check_r_mimetypes(container: TrackedContainer) -> None:
"""Check if Rscript command can be executed"""
LOGGER.info("Test that R command can be executed ...")
Rcommand = 'if (length(getOption("jupyter.plot_mimetypes")) != 5) {stop("missing jupyter.plot_mimetypes")}'
logs = container.run_and_wait(
timeout=10,
tty=True,
command=["Rscript", "-e", Rcommand],
)
LOGGER.debug(f"{logs=}")
assert len(logs) == 0, f"Command {Rcommand=} failed"
10 changes: 10 additions & 0 deletions tests/datascience-notebook/test_mimetypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from tests.conftest import TrackedContainer
from tests.R_mimetype_check import check_r_mimetypes


def test_mimetypes(container: TrackedContainer) -> None:
"""Check if Rscript command for mimetypes can be executed"""
check_r_mimetypes(container)
19 changes: 0 additions & 19 deletions tests/minimal-notebook/test_inkscape.py

This file was deleted.

10 changes: 10 additions & 0 deletions tests/r-notebook/test_R_mimetypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from tests.conftest import TrackedContainer
from tests.R_mimetype_check import check_r_mimetypes


def test_mimetypes(container: TrackedContainer) -> None:
"""Check if Rscript command for mimetypes can be executed"""
check_r_mimetypes(container)