Skip to content

Commit

Permalink
Merge pull request #1635 from mathbunnyru/asalikhov/fix_cython
Browse files Browse the repository at this point in the history
Fix cython in scipy-notebook
  • Loading branch information
mathbunnyru authored Feb 21, 2022
2 parents 854da97 + 3b83254 commit 13107fc
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
10 changes: 8 additions & 2 deletions scipy-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"

USER root

# ffmpeg for matplotlib anim & dvipng+cm-super for latex labels
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends ffmpeg dvipng cm-super && \
apt-get install --yes --no-install-recommends \
# for cython: https://cython.readthedocs.io/en/latest/src/quickstart/install.html
build-essential \
# for latex labels
cm-super \
dvipng \
# for matplotlib anim
ffmpeg && \
apt-get clean && rm -rf /var/lib/apt/lists/*

USER ${NB_UID}
Expand Down
2 changes: 1 addition & 1 deletion tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[pytest]
addopts = -ra --color=yes
log_cli = 1
log_cli_level = INFO
log_cli_level = DEBUG
log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)
log_cli_date_format=%Y-%m-%d %H:%M:%S
markers =
Expand Down
1 change: 1 addition & 0 deletions tests/scipy-notebook/data/cython/helloworld.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello World")
4 changes: 4 additions & 0 deletions tests/scipy-notebook/data/cython/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from setuptools import setup
from Cython.Build import cythonize

setup(ext_modules=cythonize("helloworld.pyx"))
27 changes: 27 additions & 0 deletions tests/scipy-notebook/test_cython.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from pathlib import Path

from conftest import TrackedContainer

THIS_DIR = Path(__file__).parent.resolve()


def test_cython(container: TrackedContainer) -> None:
host_data_dir = THIS_DIR / "data/cython"
cont_data_dir = "/home/jovyan/data"

logs = container.run_and_wait(
timeout=10,
volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}},
tty=True,
command=[
"start.sh",
"bash",
"-c",
# We copy our data to temporary folder to be able to modify the directory
f"cp -r {cont_data_dir}/ /tmp/test/ && cd /tmp/test && python3 setup.py build_ext",
],
)
assert "building 'helloworld' extension" in logs

0 comments on commit 13107fc

Please sign in to comment.