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

Install Pluto.jl and jupyter-pluto-proxy #1929

Merged
merged 11 commits into from
Jul 5, 2023
3 changes: 3 additions & 0 deletions docs/using/selecting.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ It contains:
- Everything in `jupyter/minimal-notebook` and its ancestor images
- The [Julia Programming Language](https://julialang.org/)
- [IJulia](https://github.com/JuliaLang/IJulia.jl) to support Julia code in Jupyter notebook
- [Pluto.jl](https://plutojl.org/) reactive Julia notebook interface, made accessible with [jupyter-pluto-proxy](https://github.com/yuvipanda/jupyter-pluto-proxy)
yuvipanda marked this conversation as resolved.
Show resolved Hide resolved
- [HDF5](https://github.com/JuliaIO/HDF5.jl) package

### jupyter/scipy-notebook

Expand Down Expand Up @@ -188,6 +190,7 @@ communities.
- [rpy2](https://rpy2.github.io/doc/latest/html/index.html) package
- The [Julia](https://julialang.org/) compiler and base environment
- [IJulia](https://github.com/JuliaLang/IJulia.jl) to support Julia code in Jupyter notebooks
- [Pluto.jl](https://plutojl.org/) reactive Julia notebook interface, made accessible with [jupyter-pluto-proxy](https://github.com/yuvipanda/jupyter-pluto-proxy)
- [HDF5](https://github.com/JuliaIO/HDF5.jl) package

### jupyter/pyspark-notebook
Expand Down
10 changes: 9 additions & 1 deletion minimal-notebook/setup-scripts/setup-julia-packages.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import Pkg;
Pkg.update();
Pkg.add([
"HDF5",
"IJulia"
"IJulia",
"Pluto"
]);
Pkg.precompile();
'
Expand All @@ -23,3 +24,10 @@ mv "${HOME}/.local/share/jupyter/kernels/julia"* "${CONDA_DIR}/share/jupyter/ker
chmod -R go+rx "${CONDA_DIR}/share/jupyter"
rm -rf "${HOME}/.local"
fix-permissions "${JULIA_PKGDIR}" "${CONDA_DIR}/share/jupyter"

# Install jupyter-pluto-proxy to get Pluto to work on JupyterHub
mamba install --yes \
'jupyter-pluto-proxy' && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
1 change: 1 addition & 0 deletions tests/base-notebook/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
PACKAGE_MAPPING = {
# Python
"beautifulsoup4": "bs4",
"jupyter-pluto-proxy": "jupyter_pluto_proxy",
"matplotlib-base": "matplotlib",
"pytables": "tables",
"scikit-image": "skimage",
Expand Down
32 changes: 32 additions & 0 deletions tests/datascience-notebook/test_julia_starts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import logging
import secrets
import time

import requests

from tests.conftest import TrackedContainer, find_free_port

LOGGER = logging.getLogger(__name__)


def test_pluto_proxy(
container: TrackedContainer, http_client: requests.Session
) -> None:
"""Pluto proxy starts Pluto correctly"""
host_port = find_free_port()
token = secrets.token_hex()
container.run_detached(
command=[
"start.sh",
"jupyter",
"lab",
"--port=8888",
f"--LabApp.token={token}",
],
ports={"8888/tcp": host_port},
)
# Give the server a bit of time to start
time.sleep(3)
resp = http_client.get(f"http://localhost:{host_port}/pluto?token={token}")
resp.raise_for_status()
assert "Pluto.jl notebooks" in resp.text, "Pluto.jl text not found in /pluto page"
32 changes: 32 additions & 0 deletions tests/julia-notebook/test_pluto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import logging
import secrets
import time

import requests

from tests.conftest import TrackedContainer, find_free_port

LOGGER = logging.getLogger(__name__)


def test_pluto_proxy(
container: TrackedContainer, http_client: requests.Session
) -> None:
"""Pluto proxy starts Pluto correctly"""
host_port = find_free_port()
token = secrets.token_hex()
container.run_detached(
command=[
"start.sh",
"jupyter",
"lab",
"--port=8888",
f"--LabApp.token={token}",
],
ports={"8888/tcp": host_port},
)
# Give the server a bit of time to start
time.sleep(3)
resp = http_client.get(f"http://localhost:{host_port}/pluto?token={token}")
resp.raise_for_status()
assert "Pluto.jl notebooks" in resp.text, "Pluto.jl text not found in /pluto page"