From c1c1269f2854b6015cfacf04c92f2eae7d1cf261 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:04:01 -0600 Subject: [PATCH 01/17] fix use of deprecated API and add python 3.10 test --- .github/workflows/tests.yml | 2 +- nbconvert/utils/version.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aa982a774..c4f230fbf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.7', '3.8', '3.9' ] + python-version: [ '3.7', '3.8', '3.9', '3.10'] steps: - name: Check out repository code uses: actions/checkout@v2 diff --git a/nbconvert/utils/version.py b/nbconvert/utils/version.py index 63bd14b09..a1aa5df27 100644 --- a/nbconvert/utils/version.py +++ b/nbconvert/utils/version.py @@ -8,7 +8,7 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. -from distutils.version import LooseVersion +from packaging.version import Version def check_version(v, min_v, max_v=None): @@ -27,9 +27,9 @@ def check_version(v, min_v, max_v=None): is satisfied. Users on dev branches are responsible for keeping their own packages up to date. """ - + try: - below_max = LooseVersion(v) < LooseVersion(max_v) if max_v is not None else True - return LooseVersion(v) >= LooseVersion(min_v) and below_max + below_max = Version(v) < Version(max_v) if max_v is not None else True + return Version(v) >= Version(min_v) and below_max except TypeError: return True From c546f98a2f7aa11dc19a3120fb843956d82d50f0 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:18:15 -0600 Subject: [PATCH 02/17] test on pypy --- .github/workflows/tests.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c4f230fbf..ba9d29f0e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.7', '3.8', '3.9', '3.10'] + python-version: [ '3.7', '3.8', '3.9', '3.10', 'pypy-3.7'] steps: - name: Check out repository code uses: actions/checkout@v2 @@ -50,14 +50,24 @@ jobs: pip freeze pip check - - name: Run tests + - name: Run tests with coverage + if: ${{ !startsWith(matrix.python-version, 'pypy') env: PYTHONWARNINGS: default run: | check-manifest --ignore "share/**" # cd so we test the install, not the repo cd `mktemp -d` - py.test --cov nbconvert -v --pyargs nbconvert + pytest --cov nbconvert -v --pyargs nbconvert + + - name: Run tests on pypy + if: startsWith(matrix.python-version, 'pypy') + env: + PYTHONWARNINGS: default + run: | + # cd so we test the install, not the repo + cd `mktemp -d` + pytest -v --pyargs nbconvert - name: Code coverage run: codecov From 3ce095c12bd2e2e6cbf366eebce47de5543da407 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:21:55 -0600 Subject: [PATCH 03/17] fix syntax --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba9d29f0e..b500dd10d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,7 +51,7 @@ jobs: pip check - name: Run tests with coverage - if: ${{ !startsWith(matrix.python-version, 'pypy') + if: ${{ !startsWith(matrix.python-version, 'pypy') }} env: PYTHONWARNINGS: default run: | From 7b92e1e2b232a613ea65423064445bc8ac0f17a8 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:23:08 -0600 Subject: [PATCH 04/17] clean up pypy --- .github/workflows/tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b500dd10d..b03fdc67c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,8 +62,6 @@ jobs: - name: Run tests on pypy if: startsWith(matrix.python-version, 'pypy') - env: - PYTHONWARNINGS: default run: | # cd so we test the install, not the repo cd `mktemp -d` From c7a557049d2dabea7e854d64c1d4a5194c072f98 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:31:07 -0600 Subject: [PATCH 05/17] expand test matrix --- .github/workflows/tests.yml | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b03fdc67c..e4512df3e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,14 +8,24 @@ on: jobs: run-tests: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] python-version: [ '3.7', '3.8', '3.9', '3.10', 'pypy-3.7'] + exclude: + - os: "windows-latest" + python-version: ["pypy-3.7", "3.8"] + - os: "macos-latest" + python-version: ["3.10", "pypy-3.7"] steps: - name: Check out repository code uses: actions/checkout@v2 - - name: Install dependencies + - name: Run base setup actions + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Install Linux dependencies + if: startsWith(runner.os, 'Linux') run: | sudo apt-get update sudo apt-get install texlive-plain-generic inkscape texlive-xetex @@ -23,24 +33,9 @@ jobs: # pandoc is not up to date in the ubuntu repos, so we install directly wget https://github.com/jgm/pandoc/releases/download/2.14.2/pandoc-2.14.2-1-amd64.deb && sudo dpkg -i pandoc-2.14.2-1-amd64.deb - - name: Install Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - architecture: 'x64' - - name: Cache pip on Linux - uses: actions/cache@v2 - if: startsWith(runner.os, 'Linux') - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }} - - name: Install package dependencies run: | - pip install --upgrade setuptools pip pytest - pip install -f travis-wheels/wheelhouse . codecov coverage + pip install codecov pip install nbconvert[execute,serve,test] pip install check-manifest python -m ipykernel.kernelspec --user @@ -51,7 +46,7 @@ jobs: pip check - name: Run tests with coverage - if: ${{ !startsWith(matrix.python-version, 'pypy') }} + if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(runner.os, 'Windows') }} env: PYTHONWARNINGS: default run: | @@ -60,8 +55,8 @@ jobs: cd `mktemp -d` pytest --cov nbconvert -v --pyargs nbconvert - - name: Run tests on pypy - if: startsWith(matrix.python-version, 'pypy') + - name: Run tests on pypy and Windows + if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(runner.os, 'Windows') }} run: | # cd so we test the install, not the repo cd `mktemp -d` From 891fbe30917c1a673be7a3c067890ec3dafb28b4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:31:32 -0600 Subject: [PATCH 06/17] cleanup --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e4512df3e..1c9f14d63 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: - os: "windows-latest" python-version: ["pypy-3.7", "3.8"] - os: "macos-latest" - python-version: ["3.10", "pypy-3.7"] + python-version: ["3.9", "pypy-3.7"] steps: - name: Check out repository code uses: actions/checkout@v2 From ff09e1d4e957378da2bf7f7d21e0215495476c2d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:32:10 -0600 Subject: [PATCH 07/17] cleanup --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1c9f14d63..7b085cc5c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,9 +15,9 @@ jobs: python-version: [ '3.7', '3.8', '3.9', '3.10', 'pypy-3.7'] exclude: - os: "windows-latest" - python-version: ["pypy-3.7", "3.8"] + python-version: ["3.7", "3.9"] - os: "macos-latest" - python-version: ["3.9", "pypy-3.7"] + python-version: ["3.8", "3.10"] steps: - name: Check out repository code uses: actions/checkout@v2 From 0e155dcc2151d5b0f76bee9a2f928d08157d3c8e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:34:57 -0600 Subject: [PATCH 08/17] fix install --- .github/workflows/docs.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ae29024a3..139c02c3d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.7', '3.8', '3.9' ] + python-version: [ '3.7', '3.9', '3.10' ] steps: - name: Check out repository code uses: actions/checkout@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7b085cc5c..357a5b69d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ jobs: - name: Install package dependencies run: | pip install codecov - pip install nbconvert[execute,serve,test] + pip install -e ".[execute,serve,test]" pip install check-manifest python -m ipykernel.kernelspec --user From 152f40bf8508012bd619e1177a70393b29b30e6c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:37:42 -0600 Subject: [PATCH 09/17] fix windows test --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 357a5b69d..6d2e90f36 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,6 +57,7 @@ jobs: - name: Run tests on pypy and Windows if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(runner.os, 'Windows') }} + shell: bash run: | # cd so we test the install, not the repo cd `mktemp -d` From 5ba8f094aae8a3a41de23ceee0760bbd4cb4fd7c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:41:35 -0600 Subject: [PATCH 10/17] fix windows test --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6d2e90f36..f3e85d226 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,7 +52,7 @@ jobs: run: | check-manifest --ignore "share/**" # cd so we test the install, not the repo - cd `mktemp -d` + cd $HOME pytest --cov nbconvert -v --pyargs nbconvert - name: Run tests on pypy and Windows @@ -60,7 +60,7 @@ jobs: shell: bash run: | # cd so we test the install, not the repo - cd `mktemp -d` + cd $HOME pytest -v --pyargs nbconvert - name: Code coverage From ce4e571f34dd46d05d84d4dfa07355438cdea0b9 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:47:40 -0600 Subject: [PATCH 11/17] fix windows test --- nbconvert/tests/test_nbconvertapp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nbconvert/tests/test_nbconvertapp.py b/nbconvert/tests/test_nbconvertapp.py index 48bc173d0..2d5afaa5a 100644 --- a/nbconvert/tests/test_nbconvertapp.py +++ b/nbconvert/tests/test_nbconvertapp.py @@ -287,6 +287,7 @@ def test_filename_accent_pdf(self): ' --PDFExporter.verbose=True') assert os.path.isfile(u'nb1_anĂ¡lisis.pdf') + @pytest.mark.skipif(os.name == 'nt', reason='CLI parsing does not work the same on Windows') def test_cwd_plugin(self): """ Verify that an extension in the cwd can be imported. @@ -553,7 +554,7 @@ def fig_exists(path): def test_widgets_from_nbconvert(self): """Check jupyter widgets URL""" - + with self.create_temp_cwd(["Widget_List.ipynb"]): self.nbconvert('Widget_List.ipynb --log-level 0 --to html') assert os.path.isfile('Widget_List.html') @@ -568,7 +569,7 @@ def test_widgets_from_htmlexporter(self): nb = nbformat.read(f, 4) output, _ = HTMLExporter().from_notebook_node(nb) - + assert "var widgetRendererSrc = 'https://unpkg.com/@jupyter-widgets/html-manager@*/dist/embed-amd.js';" in output def test_execute_widgets_from_nbconvert(self): From 717ff451c0cf00ba9eac008ec9adfa38b5a78a53 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:48:29 -0600 Subject: [PATCH 12/17] fix windows test --- nbconvert/preprocessors/tests/test_svg2pdf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nbconvert/preprocessors/tests/test_svg2pdf.py b/nbconvert/preprocessors/tests/test_svg2pdf.py index 04890bd9a..4bdce7639 100644 --- a/nbconvert/preprocessors/tests/test_svg2pdf.py +++ b/nbconvert/preprocessors/tests/test_svg2pdf.py @@ -73,6 +73,7 @@ def test_output(self): nb, res = preprocessor(nb, res) self.assertIn('application/pdf', nb.cells[0].outputs[0].data) + @onlyif_cmds_exist('inkscape') @patch('subprocess.Popen') def test_inkscape_version_default(self, mock_popen): mock_popen().communicate.return_value = (b'Inkscape 0.92.3 (2405546, 2018-03-11)', b'') From dc2fada68eaeeb0f2a92216360f44201eee51746 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:54:59 -0600 Subject: [PATCH 13/17] fix windows test --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f3e85d226..a4a0287b1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: python-version: [ '3.7', '3.8', '3.9', '3.10', 'pypy-3.7'] exclude: - os: "windows-latest" - python-version: ["3.7", "3.9"] + python-version: ["3.7", "pypy-3.7"] - os: "macos-latest" python-version: ["3.8", "3.10"] steps: From 9ff3dc8d77302ce2dd8603ae7d966c6f045f8a9f Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 06:59:43 -0600 Subject: [PATCH 14/17] fix excludes --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a4a0287b1..135163633 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,9 +15,9 @@ jobs: python-version: [ '3.7', '3.8', '3.9', '3.10', 'pypy-3.7'] exclude: - os: "windows-latest" - python-version: ["3.7", "pypy-3.7"] + python-version: "pypy-3.7" - os: "macos-latest" - python-version: ["3.8", "3.10"] + python-version: "3.8" steps: - name: Check out repository code uses: actions/checkout@v2 From 4570e884ccbd564d0229600c8dbbc0ff0a9b6b76 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 08:12:31 -0600 Subject: [PATCH 15/17] fix tests on py310 --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 135163633..47c33c06d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,6 +38,8 @@ jobs: pip install codecov pip install -e ".[execute,serve,test]" pip install check-manifest + # See https://github.com/pyppeteer/pyppeteer/pull/321 + pip install -U websockets python -m ipykernel.kernelspec --user - name: List installed packages From 51cbec832ec03b96f55389ed9d3bafd05703beba Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 08:21:25 -0600 Subject: [PATCH 16/17] cleanup --- .github/workflows/tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 47c33c06d..b0a3c95c8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,8 +38,6 @@ jobs: pip install codecov pip install -e ".[execute,serve,test]" pip install check-manifest - # See https://github.com/pyppeteer/pyppeteer/pull/321 - pip install -U websockets python -m ipykernel.kernelspec --user - name: List installed packages @@ -53,6 +51,8 @@ jobs: PYTHONWARNINGS: default run: | check-manifest --ignore "share/**" + # See https://github.com/pyppeteer/pyppeteer/pull/321 + pip install --force-install -U websockets # cd so we test the install, not the repo cd $HOME pytest --cov nbconvert -v --pyargs nbconvert @@ -63,6 +63,8 @@ jobs: run: | # cd so we test the install, not the repo cd $HOME + # See https://github.com/pyppeteer/pyppeteer/pull/321 + pip install --force-install -U websockets pytest -v --pyargs nbconvert - name: Code coverage From 15106b7ebf2cfcac3cbafb38a959cfd8ba6410a0 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Dec 2021 08:24:41 -0600 Subject: [PATCH 17/17] cleanup --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b0a3c95c8..caf0b89d6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,7 +52,7 @@ jobs: run: | check-manifest --ignore "share/**" # See https://github.com/pyppeteer/pyppeteer/pull/321 - pip install --force-install -U websockets + pip install -U websockets # cd so we test the install, not the repo cd $HOME pytest --cov nbconvert -v --pyargs nbconvert @@ -64,7 +64,7 @@ jobs: # cd so we test the install, not the repo cd $HOME # See https://github.com/pyppeteer/pyppeteer/pull/321 - pip install --force-install -U websockets + pip install -U websockets pytest -v --pyargs nbconvert - name: Code coverage