Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-nbclient for openSUSE:Factory checked in at 2023-05-02 16:18:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-nbclient (Old) and /work/SRC/openSUSE:Factory/.python-nbclient.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-nbclient" Tue May 2 16:18:45 2023 rev:28 rq:1083889 version:0.7.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-nbclient/python-nbclient.changes 2023-04-24 22:31:14.251519297 +0200 +++ /work/SRC/openSUSE:Factory/.python-nbclient.new.1533/python-nbclient.changes 2023-05-02 16:22:29.523043523 +0200 @@ -1,0 +2,10 @@ +Mon May 1 17:50:53 UTC 2023 - Ben Greiner <c...@bnavigator.de> + +- Update to 0.7.4 + * include stream output in CellExecutionError #282 (@minrk) + * avoid duplicate 'Exception: message' in CellExecutionError #283 + (@minrk) + * Send KeyboardInterrupt a little later in + test_run_all_notebooks[Interrupt.ipynb-opts6] #285 (@kxxt) + +------------------------------------------------------------------- Old: ---- nbclient-0.7.3.tar.gz New: ---- nbclient-0.7.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-nbclient.spec ++++++ --- /var/tmp/diff_new_pack.LL9Wdw/_old 2023-05-02 16:22:31.171053295 +0200 +++ /var/tmp/diff_new_pack.LL9Wdw/_new 2023-05-02 16:22:31.179053342 +0200 @@ -31,7 +31,7 @@ %endif Name: python-nbclient%{psuffix} -Version: 0.7.3 +Version: 0.7.4 Release: 0 Summary: A client library for executing notebooks License: BSD-3-Clause ++++++ nbclient-0.7.3.tar.gz -> nbclient-0.7.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbclient-0.7.3/PKG-INFO new/nbclient-0.7.4/PKG-INFO --- old/nbclient-0.7.3/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/nbclient-0.7.4/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nbclient -Version: 0.7.3 +Version: 0.7.4 Summary: A client library for executing notebooks. Formerly nbconvert's ExecutePreprocessor. Project-URL: Documentation, https://nbclient.readthedocs.io Project-URL: Funding, https://numfocus.org/ @@ -83,7 +83,6 @@ [](https://mybinder.org/v2/gh/jupyter/nbclient/main?filepath=binder%2Frun_nbclient.ipynb) [](https://github.com/jupyter/nbclient/actions) [](https://nbclient.readthedocs.io/en/latest/?badge=latest) -[](https://codecov.io/gh/jupyter/nbclient?branch=main) [](https://www.python.org/downloads/release/python-370/) [](https://www.python.org/downloads/release/python-380/) [](https://www.python.org/downloads/release/python-390/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbclient-0.7.3/README.md new/nbclient-0.7.4/README.md --- old/nbclient-0.7.3/README.md 2020-02-02 01:00:00.000000000 +0100 +++ new/nbclient-0.7.4/README.md 2020-02-02 01:00:00.000000000 +0100 @@ -1,7 +1,6 @@ [](https://mybinder.org/v2/gh/jupyter/nbclient/main?filepath=binder%2Frun_nbclient.ipynb) [](https://github.com/jupyter/nbclient/actions) [](https://nbclient.readthedocs.io/en/latest/?badge=latest) -[](https://codecov.io/gh/jupyter/nbclient?branch=main) [](https://www.python.org/downloads/release/python-370/) [](https://www.python.org/downloads/release/python-380/) [](https://www.python.org/downloads/release/python-390/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbclient-0.7.3/nbclient/_version.py new/nbclient-0.7.4/nbclient/_version.py --- old/nbclient-0.7.3/nbclient/_version.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbclient-0.7.4/nbclient/_version.py 2020-02-02 01:00:00.000000000 +0100 @@ -2,7 +2,7 @@ import re from typing import List, Union -__version__ = "0.7.3" +__version__ = "0.7.4" # Build up version_info tuple for backwards compatibility pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbclient-0.7.3/nbclient/client.py new/nbclient-0.7.4/nbclient/client.py --- old/nbclient-0.7.3/nbclient/client.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbclient-0.7.4/nbclient/client.py 2020-02-02 01:00:00.000000000 +0100 @@ -1017,7 +1017,6 @@ await run_hook( self.on_cell_executed, cell=cell, cell_index=cell_index, execute_reply=exec_reply ) - await self._check_raise_for_error(cell, cell_index, exec_reply) if self.coalesce_streams and cell.outputs: new_outputs = [] @@ -1056,6 +1055,8 @@ cell.outputs = new_outputs + await self._check_raise_for_error(cell, cell_index, exec_reply) + self.nb['cells'][cell_index] = cell return cell diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbclient-0.7.3/nbclient/exceptions.py new/nbclient-0.7.4/nbclient/exceptions.py --- old/nbclient-0.7.3/nbclient/exceptions.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbclient-0.7.4/nbclient/exceptions.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,5 +1,5 @@ """Exceptions for nbclient.""" -from typing import Dict +from typing import Dict, List from nbformat import NotebookNode @@ -74,41 +74,55 @@ def __str__(self) -> str: """Str repr.""" - s = self.__unicode__() - if not isinstance(s, str): - s = s.encode('utf8', 'replace') - return s - - def __unicode__(self) -> str: - """Unicode repr.""" - return self.traceback + if self.traceback: + return self.traceback + else: + return f"{self.ename}: {self.evalue}" @classmethod def from_cell_and_msg(cls, cell: NotebookNode, msg: Dict) -> "CellExecutionError": """Instantiate from a code cell object and a message contents (message is either execute_reply or error) """ + + # collect stream outputs for our error message + stream_outputs: List[str] = [] + for output in cell.outputs: + if output["output_type"] == "stream": + stream_outputs.append( + stream_output_msg.format(name=output["name"], text=output["text"].rstrip()) + ) + if stream_outputs: + # add blank line before, trailing separator + # if there is any stream output to display + stream_outputs.insert(0, "") + stream_outputs.append("------------------") + stream_output: str = "\n".join(stream_outputs) + tb = '\n'.join(msg.get('traceback', []) or []) return cls( exec_err_msg.format( cell=cell, + stream_output=stream_output, traceback=tb, - ename=msg.get('ename', '<Error>'), - evalue=msg.get('evalue', ''), ), ename=msg.get('ename', '<Error>'), evalue=msg.get('evalue', ''), ) +stream_output_msg: str = """\ +----- {name} ----- +{text}""" + exec_err_msg: str = """\ An error occurred while executing the following cell: ------------------ {cell.source} ------------------ +{stream_output} {traceback} -{ename}: {evalue} """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' "old/nbclient-0.7.3/nbclient/tests/files/Skip Exceptions with Cell Tags.ipynb" "new/nbclient-0.7.4/nbclient/tests/files/Skip Exceptions with Cell Tags.ipynb" --- "old/nbclient-0.7.3/nbclient/tests/files/Skip Exceptions with Cell Tags.ipynb" 2020-02-02 01:00:00.000000000 +0100 +++ "new/nbclient-0.7.4/nbclient/tests/files/Skip Exceptions with Cell Tags.ipynb" 2020-02-02 01:00:00.000000000 +0100 @@ -10,18 +10,35 @@ }, "outputs": [ { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "errorred\n" + ] + }, + { "ename": "Exception", "evalue": "message", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m<ipython-input-1-644b5753a261>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# üñîçøâé\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"message\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "Cell \u001b[0;32mIn[1], line 5\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124merrorred\u001b[39m\u001b[38;5;124m\"\u001b[39m, file\u001b[38;5;241m=\u001b[39msys\u001b[38;5;241m.\u001b[39mstderr)\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# üñîçøâé\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessage\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", "\u001b[0;31mException\u001b[0m: message" ] } ], "source": [ + "import sys\n", + "print(\"hello\")\n", + "print(\"errorred\", file=sys.stderr)\n", "# üñîçøâé\n", "raise Exception(\"message\")" ] @@ -44,7 +61,32 @@ ] } ], - "metadata": {}, + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.9" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "state": {}, + "version_major": 2, + "version_minor": 0 + } + } + }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbclient-0.7.3/nbclient/tests/test_client.py new/nbclient-0.7.4/nbclient/tests/test_client.py --- old/nbclient-0.7.3/nbclient/tests/test_client.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbclient-0.7.4/nbclient/tests/test_client.py 2020-02-02 01:00:00.000000000 +0100 @@ -5,6 +5,7 @@ import functools import os import re +import sys import threading import warnings from base64 import b64decode, b64encode @@ -323,7 +324,7 @@ "Interrupt.ipynb", { "kernel_name": "python", - "timeout": 1, + "timeout": 3, "interrupt_on_timeout": True, "allow_errors": True, }, @@ -708,8 +709,13 @@ res['metadata']['path'] = os.path.dirname(filename) with pytest.raises(CellExecutionError) as exc: run_notebook(filename, {"allow_errors": False}, res) - self.assertIsInstance(str(exc.value), str) - assert "# üñîçøâé" in str(exc.value) + + assert isinstance(str(exc.value), str) + exc_str = strip_ansi(str(exc.value)) + # FIXME: we seem to have an encoding problem on Windows + # same check in force_raise_errors + if not sys.platform.startswith("win"): + assert "# üñîçøâé" in exc_str def test_force_raise_errors(self): """ @@ -721,8 +727,23 @@ res['metadata']['path'] = os.path.dirname(filename) with pytest.raises(CellExecutionError) as exc: run_notebook(filename, {"force_raise_errors": True}, res) - self.assertIsInstance(str(exc.value), str) - assert "# üñîçøâé" in str(exc.value) + + # verify CellExecutionError contents + exc_str = strip_ansi(str(exc.value)) + # print for better debugging with captured output + # print(exc_str) + assert "Exception: message" in exc_str + # FIXME: unicode handling seems to have a problem on Windows + # same check in allow_errors + if not sys.platform.startswith("win"): + assert "# üñîçøâé" in exc_str + assert "stderr" in exc_str + assert "stdout" in exc_str + assert "hello\n" in exc_str + assert "errorred\n" in exc_str + # stricter check for stream output format + assert "\n".join(["", "----- stdout -----", "hello", "---"]) in exc_str + assert "\n".join(["", "----- stderr -----", "errorred", "---"]) in exc_str def test_reset_kernel_client(self): filename = os.path.join(current_dir, 'files', 'HelloWorld.ipynb') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbclient-0.7.3/pyproject.toml new/nbclient-0.7.4/pyproject.toml --- old/nbclient-0.7.3/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/nbclient-0.7.4/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -100,7 +100,7 @@ [tool.hatch.envs.cov] features = ["test"] -dependencies = ["coverage", "pytest-cov"] +dependencies = ["coverage[toml]", "pytest-cov"] [tool.hatch.envs.cov.scripts] test = "python -m pytest -vv --cov nbclient --cov-branch --cov-report term-missing:skip-covered {args}" nowarn = "test -W default {args}" @@ -156,6 +156,10 @@ "@(abc\\.)?abstractmethod", ] +[tool.coverage.run] +relative_files = true +source = ["nbclient"] + [tool.mypy] python_version = 3.9 check_untyped_defs = true