Skip to content

Commit 66a12ac

Browse files
authored
Install latest version of nbconvert to fix Jinja issue. (#1141)
The latest version of Jinja changed the import for `Markup`. The import was fixed in the latest version of `nbconvert`: jupyter/nbconvert#1736 We include the version of `nbconvert` from the DLVM base image which is released every ~2 weeks. However, the `nbconvert` fix was released only 6 hours ago. Temporarily install thel latest version of `nbconvert`. Add a test to prevent regression. http://b/227194111
1 parent 59d6b8a commit 66a12ac

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Dockerfile.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,14 +389,14 @@ RUN pip install bleach && \
389389
pip install ipywidgets && \
390390
pip install isoweek && \
391391
pip install jedi && \
392-
pip install Jinja2 && \
393392
pip install jsonschema && \
394393
pip install jupyter-client && \
395394
pip install jupyter-console && \
396395
pip install jupyter-core && \
397396
pip install MarkupSafe && \
398397
pip install mistune && \
399-
pip install nbconvert && \
398+
# b/227194111 install latest version of nbconvert until the base image includes nbconvert >= 6.4.5
399+
pip install --upgrade nbconvert Jinja2 && \
400400
pip install nbformat && \
401401
pip install notebook && \
402402
pip install papermill && \

tests/test_jupyter_nbconvert.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import subprocess
44

55
class TestJupyterNbconvert(unittest.TestCase):
6-
def test_nbconvert(self):
6+
def test_nbconvert_to_notebook(self):
77
result = subprocess.run([
88
'jupyter',
99
'nbconvert',
@@ -17,4 +17,20 @@ def test_nbconvert(self):
1717
], stdout=subprocess.PIPE)
1818

1919
self.assertEqual(0, result.returncode)
20-
self.assertTrue(b'999' in result.stdout)
20+
self.assertTrue(b'999' in result.stdout)
21+
22+
def test_nbconvert_to_html(self):
23+
result = subprocess.run([
24+
'jupyter',
25+
'nbconvert',
26+
'--to',
27+
'html',
28+
'--template',
29+
'/opt/kaggle/nbconvert-extensions.tpl',
30+
'--execute',
31+
'--stdout',
32+
'/input/tests/data/notebook.ipynb',
33+
], stdout=subprocess.PIPE)
34+
35+
self.assertEqual(0, result.returncode)
36+
self.assertTrue(b'999' in result.stdout)

0 commit comments

Comments
 (0)