Skip to content

Commit 13107fc

Browse files
authored
Merge pull request #1635 from mathbunnyru/asalikhov/fix_cython
Fix cython in scipy-notebook
2 parents 854da97 + 3b83254 commit 13107fc

File tree

5 files changed

+41
-3
lines changed

5 files changed

+41
-3
lines changed

scipy-notebook/Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ LABEL maintainer="Jupyter Project <[email protected]>"
88

99
USER root
1010

11-
# ffmpeg for matplotlib anim & dvipng+cm-super for latex labels
1211
RUN apt-get update --yes && \
13-
apt-get install --yes --no-install-recommends ffmpeg dvipng cm-super && \
12+
apt-get install --yes --no-install-recommends \
13+
# for cython: https://cython.readthedocs.io/en/latest/src/quickstart/install.html
14+
build-essential \
15+
# for latex labels
16+
cm-super \
17+
dvipng \
18+
# for matplotlib anim
19+
ffmpeg && \
1420
apt-get clean && rm -rf /var/lib/apt/lists/*
1521

1622
USER ${NB_UID}

tests/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[pytest]
22
addopts = -ra --color=yes
33
log_cli = 1
4-
log_cli_level = INFO
4+
log_cli_level = DEBUG
55
log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)
66
log_cli_date_format=%Y-%m-%d %H:%M:%S
77
markers =
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello World")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from setuptools import setup
2+
from Cython.Build import cythonize
3+
4+
setup(ext_modules=cythonize("helloworld.pyx"))

tests/scipy-notebook/test_cython.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
3+
4+
from pathlib import Path
5+
6+
from conftest import TrackedContainer
7+
8+
THIS_DIR = Path(__file__).parent.resolve()
9+
10+
11+
def test_cython(container: TrackedContainer) -> None:
12+
host_data_dir = THIS_DIR / "data/cython"
13+
cont_data_dir = "/home/jovyan/data"
14+
15+
logs = container.run_and_wait(
16+
timeout=10,
17+
volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}},
18+
tty=True,
19+
command=[
20+
"start.sh",
21+
"bash",
22+
"-c",
23+
# We copy our data to temporary folder to be able to modify the directory
24+
f"cp -r {cont_data_dir}/ /tmp/test/ && cd /tmp/test && python3 setup.py build_ext",
25+
],
26+
)
27+
assert "building 'helloworld' extension" in logs

0 commit comments

Comments
 (0)