Skip to content

Commit

Permalink
Add support for jupyter_client 8 (#1867)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Oct 6, 2022
1 parent 680e37d commit 29169a1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Expand Up @@ -67,7 +67,7 @@ jobs:
pip freeze
pip check
- name: Run tests with coverage
- name: Run tests on MacOS
if: ${{ startsWith(runner.os, 'macos') }}
shell: bash -l {0}
run: |
Expand All @@ -76,15 +76,14 @@ jobs:
pip install -U websockets
python -m pytest --cov nbconvert -vv
- name: Run tests on pypy and Windows
- name: Run tests on Linux
if: ${{ startsWith(runner.os, 'linux') }}
shell: bash -l {0}
run: |
conda activate nbconvert
# See https://github.com/pyppeteer/pyppeteer/pull/321
pip install -U websockets
#python -m pytest -vv
xvfb-run --auto-servernum `which coverage` run -m pytest -vv
NBFORMAT_VALIDATOR=jsonschema xvfb-run --auto-servernum `which coverage` run -m pytest -vv
- name: Run tests on pypy and Windows
if: ${{ startsWith(runner.os, 'Windows') }}
Expand Down Expand Up @@ -136,6 +135,7 @@ jobs:
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
- name: Run the unit tests
run: |
export NBFORMAT_VALIDATOR=jsonschema
pytest -vv -W default || pytest -vv -W default --lf
test_prereleases:
Expand All @@ -156,7 +156,7 @@ jobs:
pip check
- name: Run the tests
run: |
pytest -vv || pytest -vv --lf
pytest -vv -W default || pytest -vv -W default --lf
make_sdist:
name: Make SDist
Expand Down
2 changes: 1 addition & 1 deletion docs/source/changelog.rst
Expand Up @@ -9,7 +9,7 @@ Changes in nbconvert
* Fix markdown table not render bug by @Neutree in :ghpull:`1853`
* Replace lxml.html.clean_html with bleach; drop lxml dependency by @akx in :ghpull:`1854`
* Remove CircleCI badge from README by @akx in :ghpull:`1857`
* Added support for section (slide) "data-*" attributes by @bouzidanas in :ghpull:`1861`
* Added support for section (slide) ``"data-*"`` attributes by @bouzidanas in :ghpull:`1861`

7.0.0
-----
Expand Down
1 change: 1 addition & 0 deletions nbconvert/exporters/tests/test_latex.py
Expand Up @@ -160,6 +160,7 @@ def test_svg(self):
Can a LatexExporter export when it recieves raw binary strings form svg?
"""
filename = os.path.join(current_dir, "files", "svg.ipynb")

(output, resources) = LatexExporter().from_filename(filename)
assert len(output) > 0

Expand Down
2 changes: 2 additions & 0 deletions nbconvert/exporters/tests/test_rst.py
Expand Up @@ -40,11 +40,13 @@ def test_empty_code_cell(self):
with open(nbname, encoding="utf8") as f:
nb = nbformat.read(f, 4)

nb = v4.upgrade(nb)
exporter = self.exporter_class()

(output, resources) = exporter.from_notebook_node(nb)
# add an empty code cell
nb.cells.append(v4.new_code_cell(source=""))

(output2, resources) = exporter.from_notebook_node(nb)
# adding an empty code cell shouldn't change output
self.assertEqual(output.strip(), output2.strip())
Expand Down
2 changes: 2 additions & 0 deletions nbconvert/preprocessors/execute.py
@@ -1,6 +1,7 @@
"""Module containing a preprocessor that executes the code cells
and updates outputs"""

from jupyter_client.manager import KernelManager
from nbclient import NotebookClient
from nbclient import execute as _execute

Expand Down Expand Up @@ -35,6 +36,7 @@ class ExecutePreprocessor(Preprocessor, NotebookClient):

def __init__(self, **kw):
nb = kw.get("nb")
kw.setdefault("kernel_manager_class", KernelManager)
Preprocessor.__init__(self, nb=nb, **kw)
NotebookClient.__init__(self, nb, **kw)

Expand Down
2 changes: 1 addition & 1 deletion nbconvert/preprocessors/svg2pdf.py
Expand Up @@ -148,6 +148,6 @@ def convert_figure(self, data_format, data):
if os.path.isfile(output_filename):
with open(output_filename, "rb") as f:
# PDF is a nb supported binary, data type, so base64 encode.
return base64.encodebytes(f.read())
return base64.encodebytes(f.read()).decode("utf-8")
else:
raise TypeError("Inkscape svg to pdf conversion failed")

0 comments on commit 29169a1

Please sign in to comment.