From c7fc47c89e50adc94510aec67612c59ddb491ced Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Sat, 25 May 2019 17:51:34 +0200 Subject: [PATCH] Invalid notebooks may cause a warning, but not a fatal error Fixes #234 --- HISTORY.rst | 9 +++ jupytext/jupytext.py | 20 ++++++- .../R notebook with invalid cell keys.ipynb | 55 +++++++++++++++++++ .../R notebook with invalid cell keys.Rmd | 14 +++++ .../R notebook with invalid cell keys.md | 14 +++++ .../julia_benchmark_plotly_barchart.md | 2 +- .../R notebook with invalid cell keys.R | 14 +++++ .../R notebook with invalid cell keys.low.r | 14 +++++ .../R notebook with invalid cell keys.R | 12 ++++ .../R notebook with invalid cell keys.low.r | 12 ++++ .../R notebook with invalid cell keys.R | 12 ++++ .../R notebook with invalid cell keys.low.r | 12 ++++ tests/test_contentsmanager.py | 2 +- tests/test_mirror.py | 2 +- 14 files changed, 188 insertions(+), 6 deletions(-) create mode 100644 tests/notebooks/ipynb_R/R notebook with invalid cell keys.ipynb create mode 100644 tests/notebooks/mirror/ipynb_to_Rmd/R notebook with invalid cell keys.Rmd create mode 100644 tests/notebooks/mirror/ipynb_to_md/R notebook with invalid cell keys.md create mode 100644 tests/notebooks/mirror/ipynb_to_percent/R notebook with invalid cell keys.R create mode 100644 tests/notebooks/mirror/ipynb_to_percent/R notebook with invalid cell keys.low.r create mode 100644 tests/notebooks/mirror/ipynb_to_script/R notebook with invalid cell keys.R create mode 100644 tests/notebooks/mirror/ipynb_to_script/R notebook with invalid cell keys.low.r create mode 100644 tests/notebooks/mirror/ipynb_to_spin/R notebook with invalid cell keys.R create mode 100644 tests/notebooks/mirror/ipynb_to_spin/R notebook with invalid cell keys.low.r diff --git a/HISTORY.rst b/HISTORY.rst index ecf1064a8..04abcd3fc 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,15 @@ Release History --------------- +1.1.4 (2019-05-25) +++++++++++++++++++++++ + +**Improvements** + +**BugFixes** +- Invalid notebooks may cause a warning, but not a fatal error (#234) + + 1.1.3 (2019-05-22) ++++++++++++++++++++++ diff --git a/jupytext/jupytext.py b/jupytext/jupytext.py index 6bb2dcab7..3b3649f34 100644 --- a/jupytext/jupytext.py +++ b/jupytext/jupytext.py @@ -104,10 +104,19 @@ def writes(self, nb, metadata=None, **kwargs): else: cells.append(NotebookNode(source=cell.source, metadata=cell_metadata, cell_type=cell.cell_type)) - return notebook_to_md(new_notebook(metadata=metadata, cells=cells)) + return notebook_to_md(NotebookNode( + nbformat=nb.nbformat, + nbformat_minor=nb.nbformat_minor, + metadata=metadata, + cells=cells)) # Copy the notebook, in order to be sure we do not modify the original notebook - nb = new_notebook(cells=nb.cells, metadata=deepcopy(metadata or nb.metadata)) + nb = NotebookNode( + nbformat=nb.nbformat, + nbformat_minor=nb.nbformat_minor, + metadata=deepcopy(metadata or nb.metadata), + cells=nb.cells) + metadata = nb.metadata default_language = default_language_from_metadata_and_ext(metadata, self.implementation.extension) self.update_fmt_with_notebook_options(nb.metadata) @@ -250,7 +259,12 @@ def writes(notebook, fmt, version=nbformat.NO_CONVERT, **kwargs): jupytext_metadata.pop('text_representation', {}) if not jupytext_metadata: metadata.pop('jupytext', {}) - return nbformat.writes(new_notebook(cells=notebook.cells, metadata=metadata), version, **kwargs) + return nbformat.writes( + NotebookNode( + nbformat=notebook.nbformat, + nbformat_minor=notebook.nbformat_minor, + metadata=metadata, + cells=notebook.cells), version, **kwargs) if not format_name: format_name = format_name_for_ext(metadata, ext, explicit_default=False) diff --git a/tests/notebooks/ipynb_R/R notebook with invalid cell keys.ipynb b/tests/notebooks/ipynb_R/R notebook with invalid cell keys.ipynb new file mode 100644 index 000000000..7bae6fc8b --- /dev/null +++ b/tests/notebooks/ipynb_R/R notebook with invalid cell keys.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": {}, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAANICAMAAADKOT/pAAAC2VBMVEUAAAABAQECAgIDAwME\nBAQFBQUGBgYHBwcICAgJCQkKCgoLCwsMDAwNDQ0PDw8QEBARERETExMUFBQVFRUWFhYXFxcY\nGBgZGRkaGhobGxscHBwdHR0eHh4fHx8gICAhISEiIiIjIyMkJCQlJSUmJiYnJycoKCgpKSkq\nKiorKyssLCwtLS0uLi4vLy8wMDAxMTEyMjIzMzM0NDQ4ODg5OTk6Ojo8PDw9PT0/Pz9AQEBB\nQUFCQkJDQ0NERERGRkZHR0dISEhJSUlLS0tMTExNTU1OTk5PT09QUFBRUVFSUlJTU1NUVFRV\nVVVWVlZXV1dYWFhZWVlaWlpbW1tcXFxdXV1eXl5fX19gYGBhYWFiYmJjY2NkZGRlZWVmZmZn\nZ2doaGhpaWlqampra2tsbGxtbW1ubm5vb29wcHBxcXFycnJzc3N0dHR1dXV2dnZ3d3d4eHh5\neXl6enp7e3t8fHx9fX1+fn5/f3+AgICBgYGCgoKDg4OEhISFhYWGhoaHh4eIiIiJiYmKioqL\ni4uMjIyNjY2Ojo6Pj4+RkZGSkpKTk5OUlJSVlZWWlpaXl5eYmJiZmZmampqbm5ucnJydnZ2e\nnp6fn5+goKChoaGioqKjo6OkpKSlpaWmpqanp6eoqKipqamqqqqrq6usrKytra2urq6vr6+w\nsLCxsbGysrKzs7O0tLS1tbW2tra3t7e4uLi5ubm6urq7u7u8vLy9vb2+vr6/v7/AwMDBwcHC\nwsLExMTFxcXGxsbHx8fJycnKysrLy8vMzMzNzc3Ozs7Pz8/Q0NDR0dHS0tLT09PU1NTV1dXW\n1tbX19fY2NjZ2dna2trb29vc3Nzd3d3e3t7f39/g4ODh4eHi4uLj4+Pk5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UhAEgHJCUhAEgHJCUhAEgHJCUhAEgHJCUhAEgHJCUgNNpjVcDqWeb3xRqKG\nRtORoKWxqKF8OjTzb+4779xqr07+tv5Soc5QQxWy/33OomLUUFoIGhrORw2lYyfiIR3PajAd\nzbzeeMMjUUPpUNDSaNhQenLm3/xK8rP/vtoFP6i/lD8RdKRCMWjoeNhQmg8aOhk1VPrTfSwe\nUvZ3UV7aGdV9abctud5f4qWdUZu/tMs+M5CMgOQEpJCA5AQkIyDFDAHJGQKSDkgxAckJSEAS\nAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEAS\nAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEAS\nAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEAS\nAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEASAckJSEAS\nAckJSEASNQvpa790/nhvfdvPnz9jbwLSeEAKaR5CWp+85tzx3nBunX72fn8SSEZAihlqI0ib\nxu/UfWnXUEAyAlLMEJCcISDpgBQTkJyABCQRkJyABCQRkJyABCQRkJyABCQRkJyABCQRkJyA\nBCQRkJyABCQRkJyABCQRkJyABCQRkJyABCQRkJyABCQRkJyABCQRkJyABCQRkJyABCQRkJyA\nBCQRkJyABCQRkJyABCQRkJyABCRRw5D+6T3vnNp5QGokIIU0HyA9k5wz7fOB/tXj49eB5ASk\nkOYHpFzmdSA5ASkkIDkByQhIMUNAcoaApANSTEByAhKQREByAhKQREByAhKQREByAhKQREBy\nAhKQREByAhKQREByAhKQREByAhKQREByAhKQREByAhKQREByAhKQREByAhKQREByWpCQfpxJ\nZG/PZSvuL0482JEr93TtZSAZAamZOgnSq/77l/OnOdq3eNOB3d1bTkFaNlBqqPYykIyA1Eyd\nBGn5Tydv/pMf1kBaf13ppnfJ8ASk5ZmXgWQEpGbqJEjp4Y3vSM7+7YfHpum6p3TT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nJznrz0sPFp/9k/KVt5b/78F/7+z9abouuat09y8TIJ3xgNRZbU02lH954+sKpdtbk2+Wr9xU\nvrI7+Uya/vq/zJfuFt8MpDMekDqrrcnW8i9v/9Xy7ZZkR/lKb/n+88kH0/S176580W8C6YwH\npM5qa/Jw+Ze3v7N8uyX5SvnK5vL9fcm1JUi/UfkiIJ35gNRZZUG6vnz/wSkv7d4CpDMekDqr\nLEjnHkzT0d8463tp+tHkntLlXt5sOPMBqbPKgtT1b9bf9u5kdenCkbe+6g/v/uPX/8qrW3rG\nBRmQOqssSNs+/bZzfuGWysdUvbD0Z15zQd973tDKIy7MgNTpTdCa2lvf1YqDLOyA1OlNg1T5\nfwz218maVh1m4QakTm8apEVX33n3Na8676XWHWehBqRObxqkT7/zZ/7ZeVf/uHWnWbABiSgg\nIBEFBCSigIBEFBCQiAICElFAQCIKCEhEAQGJKCAgEQX0/wGzfpX+X7ybXAAAAABJRU5ErkJg\ngg==", + "text/plain": [ + "plot without title" + ] + }, + "metadata": {}, + "output_type": "display_data", + "source": "R display func" + } + ], + "source": [ + "library(\"ggplot2\")\n", + "ggplot(mtcars, aes(mpg)) + stat_ecdf()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "R", + "language": "R", + "name": "ir" + }, + "language_info": { + "codemirror_mode": "r", + "file_extension": ".r", + "mimetype": "text/x-r-source", + "name": "R", + "pygments_lexer": "r", + "version": "3.5.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/tests/notebooks/mirror/ipynb_to_Rmd/R notebook with invalid cell keys.Rmd b/tests/notebooks/mirror/ipynb_to_Rmd/R notebook with invalid cell keys.Rmd new file mode 100644 index 000000000..c7e2bb294 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_Rmd/R notebook with invalid cell keys.Rmd @@ -0,0 +1,14 @@ +--- +jupyter: + kernelspec: + display_name: R + language: R + name: ir +--- + +This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0. + +```{r} +library("ggplot2") +ggplot(mtcars, aes(mpg)) + stat_ecdf() +``` diff --git a/tests/notebooks/mirror/ipynb_to_md/R notebook with invalid cell keys.md b/tests/notebooks/mirror/ipynb_to_md/R notebook with invalid cell keys.md new file mode 100644 index 000000000..f7d01802e --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_md/R notebook with invalid cell keys.md @@ -0,0 +1,14 @@ +--- +jupyter: + kernelspec: + display_name: R + language: R + name: ir +--- + +This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0. + +```R +library("ggplot2") +ggplot(mtcars, aes(mpg)) + stat_ecdf() +``` diff --git a/tests/notebooks/mirror/ipynb_to_pandoc/julia_benchmark_plotly_barchart.md b/tests/notebooks/mirror/ipynb_to_pandoc/julia_benchmark_plotly_barchart.md index 6b5d854cd..74294f4a4 100644 --- a/tests/notebooks/mirror/ipynb_to_pandoc/julia_benchmark_plotly_barchart.md +++ b/tests/notebooks/mirror/ipynb_to_pandoc/julia_benchmark_plotly_barchart.md @@ -5,7 +5,7 @@ jupyter: language: python name: python3 nbformat: 4 - nbformat_minor: 2 + nbformat_minor: 1 --- ::: {.cell .code} diff --git a/tests/notebooks/mirror/ipynb_to_percent/R notebook with invalid cell keys.R b/tests/notebooks/mirror/ipynb_to_percent/R notebook with invalid cell keys.R new file mode 100644 index 000000000..5d5ada585 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_percent/R notebook with invalid cell keys.R @@ -0,0 +1,14 @@ +# --- +# jupyter: +# kernelspec: +# display_name: R +# language: R +# name: ir +# --- + +# %% [markdown] +# This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0. + +# %% +library("ggplot2") +ggplot(mtcars, aes(mpg)) + stat_ecdf() diff --git a/tests/notebooks/mirror/ipynb_to_percent/R notebook with invalid cell keys.low.r b/tests/notebooks/mirror/ipynb_to_percent/R notebook with invalid cell keys.low.r new file mode 100644 index 000000000..5d5ada585 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_percent/R notebook with invalid cell keys.low.r @@ -0,0 +1,14 @@ +# --- +# jupyter: +# kernelspec: +# display_name: R +# language: R +# name: ir +# --- + +# %% [markdown] +# This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0. + +# %% +library("ggplot2") +ggplot(mtcars, aes(mpg)) + stat_ecdf() diff --git a/tests/notebooks/mirror/ipynb_to_script/R notebook with invalid cell keys.R b/tests/notebooks/mirror/ipynb_to_script/R notebook with invalid cell keys.R new file mode 100644 index 000000000..4f9368f05 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_script/R notebook with invalid cell keys.R @@ -0,0 +1,12 @@ +# --- +# jupyter: +# kernelspec: +# display_name: R +# language: R +# name: ir +# --- + +# This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0. + +library("ggplot2") +ggplot(mtcars, aes(mpg)) + stat_ecdf() diff --git a/tests/notebooks/mirror/ipynb_to_script/R notebook with invalid cell keys.low.r b/tests/notebooks/mirror/ipynb_to_script/R notebook with invalid cell keys.low.r new file mode 100644 index 000000000..4f9368f05 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_script/R notebook with invalid cell keys.low.r @@ -0,0 +1,12 @@ +# --- +# jupyter: +# kernelspec: +# display_name: R +# language: R +# name: ir +# --- + +# This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0. + +library("ggplot2") +ggplot(mtcars, aes(mpg)) + stat_ecdf() diff --git a/tests/notebooks/mirror/ipynb_to_spin/R notebook with invalid cell keys.R b/tests/notebooks/mirror/ipynb_to_spin/R notebook with invalid cell keys.R new file mode 100644 index 000000000..4f9368f05 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_spin/R notebook with invalid cell keys.R @@ -0,0 +1,12 @@ +# --- +# jupyter: +# kernelspec: +# display_name: R +# language: R +# name: ir +# --- + +# This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0. + +library("ggplot2") +ggplot(mtcars, aes(mpg)) + stat_ecdf() diff --git a/tests/notebooks/mirror/ipynb_to_spin/R notebook with invalid cell keys.low.r b/tests/notebooks/mirror/ipynb_to_spin/R notebook with invalid cell keys.low.r new file mode 100644 index 000000000..4f9368f05 --- /dev/null +++ b/tests/notebooks/mirror/ipynb_to_spin/R notebook with invalid cell keys.low.r @@ -0,0 +1,12 @@ +# --- +# jupyter: +# kernelspec: +# display_name: R +# language: R +# name: ir +# --- + +# This notebook was created with IRKernel 0.8.12, and is not completely valid, as the code cell below contains an unexpected 'source' entry. This did cause https://github.com/mwouts/jupytext/issues/234. Note that the problem is solved when one upgrades to IRKernel 1.0.0. + +library("ggplot2") +ggplot(mtcars, aes(mpg)) + stat_ecdf() diff --git a/tests/test_contentsmanager.py b/tests/test_contentsmanager.py index 86c14dc4c..d00d03b1a 100644 --- a/tests/test_contentsmanager.py +++ b/tests/test_contentsmanager.py @@ -117,7 +117,7 @@ def test_save_load_paired_md_notebook(nb_file, tmpdir): @requires_pandoc @skip_if_dict_is_not_ordered -@pytest.mark.parametrize('nb_file', list_notebooks('ipynb', skip='(functional|Notebook with|flavors)')) +@pytest.mark.parametrize('nb_file', list_notebooks('ipynb', skip='(functional|Notebook with|flavors|invalid)')) def test_save_load_paired_md_pandoc_notebook(nb_file, tmpdir): tmp_ipynb = 'notebook.ipynb' tmp_md = 'notebook.md' diff --git a/tests/test_mirror.py b/tests/test_mirror.py index 198cc2c6c..4fd4686e2 100644 --- a/tests/test_mirror.py +++ b/tests/test_mirror.py @@ -287,6 +287,6 @@ def test_ipynb_to_pro_percent(nb_file): @requires_pandoc -@pytest.mark.parametrize('nb_file', list_notebooks('ipynb', skip='(functional|Notebook with|flavors)')) +@pytest.mark.parametrize('nb_file', list_notebooks('ipynb', skip='(functional|Notebook with|flavors|invalid)')) def test_ipynb_to_pandoc(nb_file): assert_conversion_same_as_mirror(nb_file, 'md:pandoc', 'ipynb_to_pandoc')