Hello community, here is the log from the commit of package python-nbformat for openSUSE:Factory checked in at 2020-05-28 09:09:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-nbformat (Old) and /work/SRC/openSUSE:Factory/.python-nbformat.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-nbformat" Thu May 28 09:09:09 2020 rev:4 rq:808411 version:5.0.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-nbformat/python-nbformat.changes 2020-04-25 20:11:35.707952373 +0200 +++ /work/SRC/openSUSE:Factory/.python-nbformat.new.3606/python-nbformat.changes 2020-05-28 09:09:16.220016813 +0200 @@ -1,0 +2,14 @@ +Sat May 2 20:16:36 UTC 2020 - Arun Persaud <a...@gmx.de> + +- update to version 5.0.6: + * nbformat.read() function has a better duck-type interface and will + raise more meaningful error messages if it can't parse a notebook + document. + +- changes from version 5.0.5: + * Allow notebook format 4.0 and 4.1 to have the arbitrary JSON + mimebundles from format 4.2 for pragmatic purposes. + * Support reading/writing path-like objects has been added to read + operations. + +------------------------------------------------------------------- Old: ---- nbformat-5.0.4.tar.gz New: ---- nbformat-5.0.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-nbformat.spec ++++++ --- /var/tmp/diff_new_pack.akPmdr/_old 2020-05-28 09:09:17.572020139 +0200 +++ /var/tmp/diff_new_pack.akPmdr/_new 2020-05-28 09:09:17.576020150 +0200 @@ -17,10 +17,10 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define doc_ver 5.0.4 Name: python-nbformat -Version: 5.0.4 +Version: 5.0.6 Release: 0 -%define doc_ver 5.0.4 Summary: The Jupyter Notebook format License: BSD-3-Clause Group: Development/Languages/Python @@ -30,14 +30,6 @@ BuildRequires: fdupes BuildRequires: python-rpm-macros BuildRequires: unzip -# SECTION test requirements -BuildRequires: %{python_module ipython_genutils} -BuildRequires: %{python_module jsonschema > 2.5.0} -BuildRequires: %{python_module jupyter_core} -BuildRequires: %{python_module pytest} -BuildRequires: %{python_module testpath} -BuildRequires: %{python_module traitlets >= 4.1} -# /SECTION Requires: jupyter-nbformat = %{version} Requires: python-ipython_genutils Requires: python-jsonschema > 2.5.0 @@ -46,6 +38,14 @@ Provides: python-jupyter_nbformat = %{version} Obsoletes: python-jupyter_nbformat < %{version} BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module ipython_genutils} +BuildRequires: %{python_module jsonschema > 2.5.0} +BuildRequires: %{python_module jupyter_core} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module testpath} +BuildRequires: %{python_module traitlets >= 4.1} +# /SECTION %python_subpackages %description ++++++ nbformat-5.0.4.tar.gz -> nbformat-5.0.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/PKG-INFO new/nbformat-5.0.6/PKG-INFO --- old/nbformat-5.0.4/PKG-INFO 2020-01-22 22:42:51.000000000 +0100 +++ new/nbformat-5.0.6/PKG-INFO 2020-04-18 20:12:38.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nbformat -Version: 5.0.4 +Version: 5.0.6 Summary: The Jupyter Notebook format Home-page: http://jupyter.org Author: Jupyter Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/docs/changelog.rst new/nbformat-5.0.6/docs/changelog.rst --- old/nbformat-5.0.4/docs/changelog.rst 2020-01-22 22:40:55.000000000 +0100 +++ new/nbformat-5.0.6/docs/changelog.rst 2020-04-18 20:10:19.000000000 +0200 @@ -4,6 +4,22 @@ Changes in nbformat ========================= +In Development +============== + +5.0.6 +===== + +- nbformat.read() function has a better duck-type interface and will raise more + meaningful error messages if it can't parse a notebook document. + +5.0.5 +===== + +- Allow notebook format 4.0 and 4.1 to have the arbitrary JSON mimebundles + from format 4.2 for pragmatic purposes. +- Support reading/writing path-like objects has been added to read operations. + 5.0.4 ===== @@ -25,7 +41,7 @@ 5.0 === -`5.0 on GitHub https://github.com/jupyter/nbformat/milestone/5`__ +`5.0 on GitHub <https://github.com/jupyter/nbformat/milestone/5>`__ - Starting with 5.0, ``nbformat`` is now Python 3 only (>= 3.5) - Add execution timings in code cell metadata for v4 spec. @@ -35,7 +51,7 @@ - Link to json schema docs from format page added - Documented the editable metadata flag - Update description for collapsed field -- Documented nbformat versions 4.0-4.3 with accurate json schema specification files +- Documented notebook format versions 4.0-4.3 with accurate json schema specification files - Clarified info about :ref:`name`'s meaning for cells - Added a default execution_count of None for new_output_cell('execute_result') - Added support for handling nbjson kwargs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/docs/format_description.rst new/nbformat-5.0.6/docs/format_description.rst --- old/nbformat-5.0.4/docs/format_description.rst 2020-01-22 19:53:24.000000000 +0100 +++ new/nbformat-5.0.6/docs/format_description.rst 2020-04-01 02:08:10.000000000 +0200 @@ -98,7 +98,7 @@ .. versionchanged:: nbformat 4.0 - Heading cells have been removed, in favor of simple headings in markdown. + Heading cells have been removed in favor of simple headings in markdown. Code cells @@ -181,8 +181,16 @@ "image/png": "[base64-encoded-multiline-png-data]", "application/json": { # JSON data is included as-is - "json": "data", + "key1": "data", + "key2": ["some", "values"], + "key3": {"more": "data"} }, + "application/vnd.exampleorg.type+json": { + # JSON data, included as-is, when the mime-type key ends in +json + "key1": "data", + "key2": ["some", "values"], + "key3": {"more": "data"} + } }, "metadata" : { "image/png": { @@ -300,7 +308,6 @@ Cell attachments ---------------- -.. versionadded:: 4.1 Markdown and raw cells can have a number of attachments, typically inline images that can be referenced in the markdown content of a cell. The ``attachments`` @@ -342,6 +349,19 @@ New cell or output types will not be rendered in versions that do not recognize them, but they will be preserved. + +Because the nbformat python package used to be less strict about validating +notebook files, two features have been backported from nbformat 4.x to +nbformat 4.0. These are: + +* ``attachment`` top-level keys in the Markdown and raw cell types + (backported from nbformat 4.1) +* Mime-bundle attributes are JSON data if the mime-type key ends in ``+json`` + (backported from nbformat 4.2) + +These backports ensure that any valid nbformat 4.4 file is also a valid +nbformat 4.0 file. + Metadata ======== @@ -417,7 +437,7 @@ ==================== ================ ============== Key Value Interpretation ==================== ================ ============== -iopub.execute_input ISO 8601 format Indicates the time at which the kernel broadcast an execute_input message. This represents the time when request for work was received by the kernel. +iopub.execute_input ISO 8601 format Indicates the time at which the kernel broadcasts an execute_input message. This represents the time when request for work was received by the kernel. iopub.status.busy ISO 8601 format Indicates the time at which the iopub channel's kernel status message is 'busy'. This represents the time when work was started by the kernel. shell.execute_reply ISO 8601 format Indicates the time at which the shell channel's execute_reply status message was created. This represents the time when work was completed by the kernel. iopub.status.idle ISO 8601 format Indicates the time at which the iopub channel's kernel status message is 'idle'. This represents the time when the kernel is ready to accept new work. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/__init__.py new/nbformat-5.0.6/nbformat/__init__.py --- old/nbformat-5.0.4/nbformat/__init__.py 2020-01-06 22:02:54.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/__init__.py 2020-04-18 20:08:53.000000000 +0200 @@ -133,11 +133,14 @@ nb : NotebookNode The notebook that was read. """ - if isinstance(fp, (str, bytes)): + + try: + buf = fp.read() + except AttributeError: with io.open(fp, encoding='utf-8') as f: - return read(f, as_version, **kwargs) + return reads(f.read(), as_version, **kwargs) - return reads(fp.read(), as_version, **kwargs) + return reads(buf, as_version, **kwargs) def write(nb, fp, version=NO_CONVERT, **kwargs): @@ -158,13 +161,16 @@ If unspecified, or specified as nbformat.NO_CONVERT, the notebook's own version will be used and no conversion performed. """ - if isinstance(fp, (str, bytes)): - with io.open(fp, 'w', encoding='utf-8') as f: - return write(nb, f, version=version, **kwargs) - s = writes(nb, version, **kwargs) if isinstance(s, bytes): s = s.decode('utf8') - fp.write(s) - if not s.endswith(u'\n'): - fp.write(u'\n') + + try: + fp.write(s) + if not s.endswith(u'\n'): + fp.write(u'\n') + except AttributeError: + with io.open(fp, 'w', encoding='utf-8') as f: + f.write(s) + if not s.endswith(u'\n'): + f.write(u'\n') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/_version.py new/nbformat-5.0.6/nbformat/_version.py --- old/nbformat-5.0.4/nbformat/_version.py 2020-01-22 22:39:22.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/_version.py 2020-04-18 20:11:57.000000000 +0200 @@ -1,3 +1,3 @@ # Make sure to update package.json, too! -version_info = (5, 0, 4) +version_info = (5, 0, 6) __version__ = '.'.join(map(str, version_info)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/tests/test_api.py new/nbformat-5.0.6/nbformat/tests/test_api.py --- old/nbformat-5.0.4/nbformat/tests/test_api.py 2019-12-30 06:58:06.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/tests/test_api.py 2020-04-01 02:08:10.000000000 +0200 @@ -5,6 +5,9 @@ import json import os +import pathlib +import sys +import unittest from .base import TestsBase @@ -47,3 +50,17 @@ dest = os.path.join(td, 'echidna.ipynb') write(nb, dest) assert os.path.isfile(dest) + + @unittest.skipIf( + sys.version_info < (3, 6, 0), + "python versions 3.5 and lower don't support opening pathlib.Path objects" + ) + def test_read_write_pathlib_object(self): + """read() and write() take path-like objects such as pathlib objects""" + path = pathlib.Path(self._get_files_path()) / u'test4.ipynb' + nb = read(path, as_version=4) + + with TemporaryDirectory() as td: + dest = pathlib.Path(td) / 'echidna.ipynb' + write(nb, dest) + assert os.path.isfile(dest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/tests/test_nbformat.py new/nbformat-5.0.6/nbformat/tests/test_nbformat.py --- old/nbformat-5.0.4/nbformat/tests/test_nbformat.py 1970-01-01 01:00:00.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/tests/test_nbformat.py 2020-04-18 20:08:53.000000000 +0200 @@ -0,0 +1,42 @@ +import pytest + +from nbformat import read + + +def test_read_invalid_iowrapper(tmpdir): + ipynb_filepath = tmpdir.join("empty.ipynb") + ipynb_filepath.write("{}") + + with pytest.raises(AttributeError) as excinfo: + with ipynb_filepath.open() as fp: + read(fp, as_version=4) + assert "cells" in str(excinfo.value) + + +def test_read_invalid_filepath(tmpdir): + ipynb_filepath = tmpdir.join("empty.ipynb") + ipynb_filepath.write("{}") + + with pytest.raises(AttributeError) as excinfo: + read(str(ipynb_filepath), as_version=4) + assert "cells" in str(excinfo.value) + + +def test_read_invalid_pathlikeobj(tmpdir): + ipynb_filepath = tmpdir.join("empty.ipynb") + ipynb_filepath.write("{}") + + with pytest.raises(AttributeError) as excinfo: + read(ipynb_filepath, as_version=4) + assert "cells" in str(excinfo.value) + + +def test_read_invalid_str(tmpdir): + with pytest.raises(OSError) as excinfo: + read("not_exist_path", as_version=4) + assert "No such file or directory" in str(excinfo.value) + + +def test_read_invalid_type(tmpdir): + with pytest.raises(OSError) as excinfo: + read(123, as_version=4) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/tests/test_validator.py new/nbformat-5.0.6/nbformat/tests/test_validator.py --- old/nbformat-5.0.4/nbformat/tests/test_validator.py 2020-01-06 22:02:54.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/tests/test_validator.py 2020-04-18 20:08:53.000000000 +0200 @@ -95,9 +95,9 @@ with self.assertRaises(ValidationError) as e: validate(nb) s = str(e.exception) - self.assertRegexpMatches(s, "validating.*required.* in markdown_cell") - self.assertRegexpMatches(s, "source.* is a required property") - self.assertRegexpMatches(s, r"On instance\[u?['\"].*cells['\"]\]\[0\]") + self.assertRegex(s, "validating.*required.* in markdown_cell") + self.assertRegex(s, "source.* is a required property") + self.assertRegex(s, r"On instance\[u?['\"].*cells['\"]\]\[0\]") self.assertLess(len(s.splitlines()), 10) def test_iter_validation_error(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/v4/nbformat.v4.0.schema.json new/nbformat-5.0.6/nbformat/v4/nbformat.v4.0.schema.json --- old/nbformat-5.0.4/nbformat/v4/nbformat.v4.0.schema.json 2020-01-06 22:02:54.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/v4/nbformat.v4.0.schema.json 2020-04-01 02:08:10.000000000 +0200 @@ -113,6 +113,7 @@ "tags": {"$ref": "#/definitions/misc/metadata_tags"} } }, + "attachments": {"$ref": "#/definitions/misc/attachments"}, "source": {"$ref": "#/definitions/misc/source"} } }, @@ -136,6 +137,7 @@ }, "additionalProperties": true }, + "attachments": {"$ref": "#/definitions/misc/attachments"}, "source": {"$ref": "#/definitions/misc/source"} } }, @@ -327,6 +329,16 @@ "pattern": "^[^,]+$" } }, + "attachments": { + "description": "Media attachments (e.g. inline images), stored as mimebundle keyed by filename.", + "type": "object", + "patternProperties": { + ".*": { + "description": "The attachment's data stored as a mimebundle.", + "$ref": "#/definitions/misc/mimebundle" + } + } + }, "source": { "description": "Contents of the cell, represented as an array of lines.", "$ref": "#/definitions/misc/multiline_string" @@ -339,16 +351,13 @@ "mimebundle": { "description": "A mime-type keyed dictionary of data", "type": "object", - "additionalProperties": false, - "properties": { - "application/json": { - "type": "object" - } + "additionalProperties": { + "description": "mimetype output (e.g. text/plain), represented as either an array of strings or a string.", + "$ref": "#/definitions/misc/multiline_string" }, "patternProperties": { - "^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$": { - "description": "mimetype output (e.g. text/plain), represented as either an array of strings or a string.", - "$ref": "#/definitions/misc/multiline_string" + "^application/(.*\\+)?json$": { + "description": "Mimetypes with JSON output, can be any type" } } }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/v4/nbformat.v4.1.schema.json new/nbformat-5.0.6/nbformat/v4/nbformat.v4.1.schema.json --- old/nbformat-5.0.4/nbformat/v4/nbformat.v4.1.schema.json 2020-01-06 22:02:54.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/v4/nbformat.v4.1.schema.json 2020-04-01 02:08:10.000000000 +0200 @@ -351,16 +351,13 @@ "mimebundle": { "description": "A mime-type keyed dictionary of data", "type": "object", - "additionalProperties": false, - "properties": { - "application/json": { - "type": "object" - } + "additionalProperties": { + "description": "mimetype output (e.g. text/plain), represented as either an array of strings or a string.", + "$ref": "#/definitions/misc/multiline_string" }, "patternProperties": { - "^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$": { - "description": "mimetype output (e.g. text/plain), represented as either an array of strings or a string.", - "$ref": "#/definitions/misc/multiline_string" + "^application/(.*\\+)?json$": { + "description": "Mimetypes with JSON output, can be any type" } } }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/v4/nbformat.v4.4.schema.json new/nbformat-5.0.6/nbformat/v4/nbformat.v4.4.schema.json --- old/nbformat-5.0.4/nbformat/v4/nbformat.v4.4.schema.json 2020-01-06 23:26:08.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/v4/nbformat.v4.4.schema.json 2020-04-01 02:08:10.000000000 +0200 @@ -82,7 +82,7 @@ "nbformat_minor": { "description": "Notebook format (minor number). Incremented for backward compatible changes to the notebook format.", "type": "integer", - "minimum": 3 + "minimum": 4 }, "nbformat": { "description": "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.", @@ -206,11 +206,11 @@ } }, "execution": { - "description": "Execution time for the code in the cell. This tracks time at which messages are recieved from iopub or shell channels", + "description": "Execution time for the code in the cell. This tracks time at which messages are received from iopub or shell channels", "type": "object", "properties": { "iopub.execute_input": { - "description": "header.date (in ISO 8601 format) of iopub channel's execute_input message. It indicates the time at which the kernel broadcast an execute_input message to connected frontends", + "description": "header.date (in ISO 8601 format) of iopub channel's execute_input message. It indicates the time at which the kernel broadcasts an execute_input message to connected frontends", "type": "string" }, "iopub.status.busy": { @@ -222,7 +222,7 @@ "type": "string" }, "iopub.status.idle": { - "description": "header.date (in ISO 8601 format) of iopub channel's execute_input message. It indicates the time at which kernel finished processing the associated request", + "description": "header.date (in ISO 8601 format) of iopub channel's kernel status message when the status is 'idle'. It indicates the time at which kernel finished processing the associated request", "type": "string" } }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat/v4/nbformat.v4.schema.json new/nbformat-5.0.6/nbformat/v4/nbformat.v4.schema.json --- old/nbformat-5.0.4/nbformat/v4/nbformat.v4.schema.json 2020-01-06 23:26:08.000000000 +0100 +++ new/nbformat-5.0.6/nbformat/v4/nbformat.v4.schema.json 2020-04-01 02:08:10.000000000 +0200 @@ -82,7 +82,7 @@ "nbformat_minor": { "description": "Notebook format (minor number). Incremented for backward compatible changes to the notebook format.", "type": "integer", - "minimum": 3 + "minimum": 4 }, "nbformat": { "description": "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.", @@ -206,11 +206,11 @@ } }, "execution": { - "description": "Execution time for the code in the cell. This tracks time at which messages are recieved from iopub or shell channels", + "description": "Execution time for the code in the cell. This tracks time at which messages are received from iopub or shell channels", "type": "object", "properties": { "iopub.execute_input": { - "description": "header.date (in ISO 8601 format) of iopub channel's execute_input message. It indicates the time at which the kernel broadcast an execute_input message to connected frontends", + "description": "header.date (in ISO 8601 format) of iopub channel's execute_input message. It indicates the time at which the kernel broadcasts an execute_input message to connected frontends", "type": "string" }, "iopub.status.busy": { @@ -222,7 +222,7 @@ "type": "string" }, "iopub.status.idle": { - "description": "header.date (in ISO 8601 format) of iopub channel's execute_input message. It indicates the time at which kernel finished processing the associated request", + "description": "header.date (in ISO 8601 format) of iopub channel's kernel status message when the status is 'idle'. It indicates the time at which kernel finished processing the associated request", "type": "string" } }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat.egg-info/PKG-INFO new/nbformat-5.0.6/nbformat.egg-info/PKG-INFO --- old/nbformat-5.0.4/nbformat.egg-info/PKG-INFO 2020-01-22 22:42:51.000000000 +0100 +++ new/nbformat-5.0.6/nbformat.egg-info/PKG-INFO 2020-04-18 20:12:38.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nbformat -Version: 5.0.4 +Version: 5.0.6 Summary: The Jupyter Notebook format Home-page: http://jupyter.org Author: Jupyter Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/nbformat.egg-info/SOURCES.txt new/nbformat-5.0.6/nbformat.egg-info/SOURCES.txt --- old/nbformat-5.0.4/nbformat.egg-info/SOURCES.txt 2020-01-22 22:42:51.000000000 +0100 +++ new/nbformat-5.0.6/nbformat.egg-info/SOURCES.txt 2020-04-18 20:12:38.000000000 +0200 @@ -44,6 +44,7 @@ nbformat/tests/test4plus.ipynb nbformat/tests/test_api.py nbformat/tests/test_convert.py +nbformat/tests/test_nbformat.py nbformat/tests/test_reader.py nbformat/tests/test_sign.py nbformat/tests/test_validator.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.0.4/package.json new/nbformat-5.0.6/package.json --- old/nbformat-5.0.4/package.json 2020-01-22 22:39:22.000000000 +0100 +++ new/nbformat-5.0.6/package.json 2020-04-18 20:11:57.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "nbformat-schema", - "version": "5.0.4", + "version": "5.0.6", "description": "JSON schemata for Jupyter notebook formats", "main": "index.js", "files": [