Hello community, here is the log from the commit of package python-spyder-notebook for openSUSE:Factory checked in at 2020-04-22 20:50:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-spyder-notebook (Old) and /work/SRC/openSUSE:Factory/.python-spyder-notebook.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-spyder-notebook" Wed Apr 22 20:50:33 2020 rev:6 rq:795547 version:0.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-spyder-notebook/python-spyder-notebook.changes 2020-04-04 12:21:00.603705889 +0200 +++ /work/SRC/openSUSE:Factory/.python-spyder-notebook.new.2738/python-spyder-notebook.changes 2020-04-22 20:51:00.555159292 +0200 @@ -1,0 +2,44 @@ +Sun Apr 19 10:27:00 UTC 2020 - Benjamin Greiner <c...@bnavigator.de> + +- Update to version 0.2.3 + This release fixes some annoying bugs and UI glitches. + + Issues Closed + * gh#spyder-ide/spyder-notebook/issues/254 + Update badges in Readme + ([PR 255] gh#spyder-ide/spyder-notebook#255) + * gh#spyder-ide/spyder-notebook/issues/245 + Cannot undock "Notebook" pane + ([PR 256] gh#spyder-ide/spyder-notebook#256) + * gh#spyder-ide/spyder-notebook/issues/241 + Move CI to github actions + ([PR 253] gh#spyder-ide/spyder-notebook#253) + * gh#spyder-ide/spyder-notebook/issues/215 + "Open recent" menu is buggy. Flickers when moused over. + ([PR 256] gh#spyder-ide/spyder-notebook#256) + * gh#spyder-ide/spyder-notebook/issues/187 + Error when trying to open a moved recent file + ([PR 249] gh#spyder-ide/spyder-notebook#249) + * gh#spyder-ide/spyder-notebook/issues/150 + Error when saving notebooks in write-protected directory + ([PR 250] gh#spyder-ide/spyder-notebook#250) + In this release 6 issues were closed. + + Pull Requests Merged + * gh#spyder-ide/spyder-notebook#256 + PR: Use _options_menu instead of options_menu in plugin + (gh#spyder-ide/spyder-notebook#245, + gh#spyder-ide/spyder-notebook#215) + * gh#spyder-ide/spyder-notebook#255 + PR: Update badges in README + (gh#spyder-ide/spyder-notebook#254) + * gh#spyder-ide/spyder-notebook#253 + PR: Use GitHub Actions to do automatic testing + (gh#spyder-ide/spyder-notebook#241) + * gh#spyder-ide/spyder-notebook#250 + PR: Handle I/O errors when doing "Save As" + (gh#spyder-ide/spyder-notebook#150) + * gh#spyder-ide/spyder-notebook#249 + PR: Avoid reading notebook file when closing tab + (gh#spyder-ide/spyder-notebook#187) + In this release 5 pull requests were merged. + +------------------------------------------------------------------- Old: ---- spyder-notebook-0.2.2.tar.gz New: ---- spyder-notebook-0.2.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-spyder-notebook.spec ++++++ --- /var/tmp/diff_new_pack.l2vopB/_old 2020-04-22 20:51:01.103160365 +0200 +++ /var/tmp/diff_new_pack.l2vopB/_new 2020-04-22 20:51:01.107160372 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-spyder-notebook -Version: 0.2.2 +Version: 0.2.3 Release: 0 Summary: Jupyter notebook integration with Spyder License: MIT ++++++ spyder-notebook-0.2.2.tar.gz -> spyder-notebook-0.2.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-notebook-0.2.2/CHANGELOG.md new/spyder-notebook-0.2.3/CHANGELOG.md --- old/spyder-notebook-0.2.2/CHANGELOG.md 2020-02-26 13:31:06.000000000 +0100 +++ new/spyder-notebook-0.2.3/CHANGELOG.md 2020-03-21 19:33:50.000000000 +0100 @@ -1,3 +1,29 @@ +## Version 0.2.3 (2020/03/21) + +This release fixes some annoying bugs and UI glitches. + +### Issues Closed + +* [Issue 254](https://github.com/spyder-ide/spyder-notebook/issues/254) - Update badges in Readme ([PR 255](https://github.com/spyder-ide/spyder-notebook/pull/255)) +* [Issue 245](https://github.com/spyder-ide/spyder-notebook/issues/245) - Cannot undock "Notebook" pane ([PR 256](https://github.com/spyder-ide/spyder-notebook/pull/256)) +* [Issue 241](https://github.com/spyder-ide/spyder-notebook/issues/241) - Move CI to github actions ([PR 253](https://github.com/spyder-ide/spyder-notebook/pull/253)) +* [Issue 215](https://github.com/spyder-ide/spyder-notebook/issues/215) - "Open recent" menu is buggy. Flickers when moused over. ([PR 256](https://github.com/spyder-ide/spyder-notebook/pull/256)) +* [Issue 187](https://github.com/spyder-ide/spyder-notebook/issues/187) - Error when trying to open a moved recent file ([PR 249](https://github.com/spyder-ide/spyder-notebook/pull/249)) +* [Issue 150](https://github.com/spyder-ide/spyder-notebook/issues/150) - Error when saving notebooks in write-protected directory ([PR 250](https://github.com/spyder-ide/spyder-notebook/pull/250)) + +In this release 6 issues were closed. + +### Pull Requests Merged + +* [PR 256](https://github.com/spyder-ide/spyder-notebook/pull/256) - PR: Use _options_menu instead of options_menu in plugin ([245](https://github.com/spyder-ide/spyder-notebook/issues/245), [215](https://github.com/spyder-ide/spyder-notebook/issues/215)) +* [PR 255](https://github.com/spyder-ide/spyder-notebook/pull/255) - PR: Update badges in README ([254](https://github.com/spyder-ide/spyder-notebook/issues/254)) +* [PR 253](https://github.com/spyder-ide/spyder-notebook/pull/253) - PR: Use GitHub Actions to do automatic testing ([241](https://github.com/spyder-ide/spyder-notebook/issues/241)) +* [PR 250](https://github.com/spyder-ide/spyder-notebook/pull/250) - PR: Handle I/O errors when doing "Save As" ([150](https://github.com/spyder-ide/spyder-notebook/issues/150)) +* [PR 249](https://github.com/spyder-ide/spyder-notebook/pull/249) - PR: Avoid reading notebook file when closing tab ([187](https://github.com/spyder-ide/spyder-notebook/issues/187)) + +In this release 5 pull requests were merged. + + ## Version 0.2.2 (2020/02/26) This release corrects the bug fix in version 0.2.1 which was triggered opening or saving notebooks. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-notebook-0.2.2/PKG-INFO new/spyder-notebook-0.2.3/PKG-INFO --- old/spyder-notebook-0.2.2/PKG-INFO 2020-02-26 13:35:11.000000000 +0100 +++ new/spyder-notebook-0.2.3/PKG-INFO 2020-03-21 19:36:20.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: spyder-notebook -Version: 0.2.2 +Version: 0.2.3 Summary: Jupyter notebook integration with Spyder Home-page: https://github.com/spyder-ide/spyder-notebook Author: Spyder Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-notebook-0.2.2/README.md new/spyder-notebook-0.2.3/README.md --- old/spyder-notebook-0.2.2/README.md 2019-12-17 16:11:33.000000000 +0100 +++ new/spyder-notebook-0.2.3/README.md 2020-03-21 19:12:53.000000000 +0100 @@ -1,5 +1,6 @@ # Spyder notebook plugin + Spyder plugin to use Jupyter notebooks inside Spyder. Currently it supports basic functionality such as creating new notebooks, opening any notebook in your filesystem and saving notebooks at any location. @@ -11,6 +12,8 @@ ## Project details ![license](https://img.shields.io/pypi/l/spyder-notebook.svg) +[![conda version](https://img.shields.io/conda/v/spyder-ide/spyder-notebook.svg)](https://www.anaconda.com/download/) +[![download count](https://img.shields.io/conda/d/spyder-ide/spyder-notebook.svg)](https://www.anaconda.com/download/) [![pypi version](https://img.shields.io/pypi/v/spyder-notebook.svg)](https://pypi.python.org/pypi/spyder-notebook) [![Join the chat at https://gitter.im/spyder-ide/public](https://badges.gitter.im/spyder-ide/spyder.svg)](https://gitter.im/spyder-ide/public) [![OpenCollective Backers](https://opencollective.com/spyder/backers/badge.svg?color=blue)](#backers) @@ -18,8 +21,10 @@ ## Build status -[![CircleCI](https://circleci.com/gh/spyder-ide/spyder-notebook.svg?style=shield)](https://circleci.com/gh/spyder-ide/spyder-notebook) -[![Coverage Status](https://coveralls.io/repos/github/spyder-ide/spyder-notebook/badge.svg?branch=master)](https://coveralls.io/github/spyder-ide/spyder-notebook?branch=master) +[![Windows status](https://github.com/spyder-ide/spyder-notebook/workflows/Windows%20tests/badge.svg)](https://github.com/spyder-ide/spyder-notebook/actions?query=workflow%3A%22Windows+tests%22) +[![Linux status](https://github.com/spyder-ide/spyder-notebook/workflows/Linux%20tests/badge.svg)](https://github.com/spyder-ide/spyder-notebook/actions?query=workflow%3A%22Linux+tests%22) +[![MacOS status](https://github.com/spyder-ide/spyder-notebook/workflows/Macos%20tests/badge.svg)](https://github.com/spyder-ide/spyder-notebook/actions?query=workflow%3A%22Macos+tests%22) +[![codecov](https://codecov.io/gh/spyder-ide/spyder-notebook/branch/master/graph/badge.svg)](https://codecov.io/gh/spyder-ide/spyder-notebook/branch/master) [![Crowdin](https://badges.crowdin.net/spyder-notebook/localized.svg)](https://crowdin.com/project/spyder-notebook) @@ -43,8 +48,8 @@ This project depends on: -* [Spyder](https://github.com/spyder-ide/spyder) `>=3.2` -* [Notebook](https://github.com/jupyter/notebook) `>=4.3` +* [Spyder](https://github.com/spyder-ide/spyder) (version 4.x) +* [Notebook](https://github.com/jupyter/notebook) (version 4.3 or later) ## Changelog @@ -61,16 +66,12 @@ ## Overview ![example](/doc/example.gif) -## Backers - -Support us with a monthly donation and help us continue our activities. - -[![Backers](https://opencollective.com/spyder/backers.svg)](https://opencollective.com/spyder#support) +## Sponsors +Spyder and its subprojects are funded thanks to the generous support of -## Sponsors +[![Quansight](https://static.wixstatic.com/media/095d2c_2508c560e87d436ea00357abc404cf1d~mv2.png/v1/crop/x_0,y_9,w_915,h_329/fill/w_380,h_128,al_c,usm_0.66_1.00_0.01/095d2c_2508c560e87d436ea00357abc404cf1d~mv2.png)](https://www.quansight.com/)[![Numfocus](https://i2.wp.com/numfocus.org/wp-content/uploads/2017/07/NumFocus_LRG.png?fit=320%2C148&ssl=1)](https://numfocus.org/) -Become a sponsor to get your logo on our README on Github. +and the donations we have received from our users around the world through [Open Collective](https://opencollective.com/spyder/): [![Sponsors](https://opencollective.com/spyder/sponsors.svg)](https://opencollective.com/spyder#support) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-notebook-0.2.2/spyder_notebook/_version.py new/spyder-notebook-0.2.3/spyder_notebook/_version.py --- old/spyder-notebook-0.2.2/spyder_notebook/_version.py 2020-02-26 13:34:33.000000000 +0100 +++ new/spyder-notebook-0.2.3/spyder_notebook/_version.py 2020-03-21 19:35:04.000000000 +0100 @@ -1,3 +1,3 @@ """Version File.""" -VERSION_INFO = (0, 2, 2) +VERSION_INFO = (0, 2, 3) __version__ = '.'.join(map(str, VERSION_INFO)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-notebook-0.2.2/spyder_notebook/notebookplugin.py new/spyder-notebook-0.2.3/spyder_notebook/notebookplugin.py --- old/spyder-notebook-0.2.2/spyder_notebook/notebookplugin.py 2020-02-26 13:32:11.000000000 +0100 +++ new/spyder-notebook-0.2.3/spyder_notebook/notebookplugin.py 2020-03-21 19:12:53.000000000 +0100 @@ -69,7 +69,6 @@ self.untitled_num = 0 self.recent_notebooks = self.get_option('recent_notebooks', default=[]) self.recent_notebook_menu = QMenu(_("Open recent"), self) - self.options_menu = QMenu(self) layout = QVBoxLayout() @@ -80,10 +79,10 @@ menu_btn = create_toolbutton(self, icon=ima.icon('tooloptions'), tip=_('Options')) - menu_btn.setMenu(self.options_menu) + menu_btn.setMenu(self._options_menu) menu_btn.setPopupMode(menu_btn.InstantPopup) corner_widgets = {Qt.TopRightCorner: [new_notebook_btn, menu_btn]} - self.tabwidget = Tabs(self, menu=self.options_menu, + self.tabwidget = Tabs(self, menu=self._options_menu, actions=self.menu_actions, corner_widgets=corner_widgets) @@ -239,13 +238,9 @@ if client.get_filename() != WELCOME: self.save_as_action.setEnabled(True) self.open_console_action.setEnabled(True) - self.options_menu.clear() - add_actions(self.options_menu, self.menu_actions) return self.save_as_action.setEnabled(False) self.open_console_action.setEnabled(False) - self.options_menu.clear() - add_actions(self.options_menu, self.menu_actions) def add_to_recent(self, notebook): """ @@ -344,7 +339,11 @@ self.tabwidget.setCurrentIndex(0) def close_client(self, index=None, client=None, save=False): - """Close client tab from index or widget (or close current tab).""" + """ + Close client tab from index or widget (or close current tab). + + The notebook is saved if `save` is `False`. + """ if not self.tabwidget.count(): return if client is not None: @@ -356,24 +355,7 @@ is_welcome = client.get_filename() == WELCOME if not save and not is_welcome: - client.save() - wait_save = QEventLoop() - QTimer.singleShot(1000, wait_save.quit) - wait_save.exec_() - path = client.get_filename() - fname = osp.basename(path) - nb_contents = nbformat.read(path, as_version=4) - - if ('untitled' in fname and len(nb_contents['cells']) > 0 and - len(nb_contents['cells'][0]['source']) > 0): - buttons = QMessageBox.Yes | QMessageBox.No - answer = QMessageBox.question(self, self.get_plugin_title(), - _("<b>{0}</b> has been modified." - "<br>Do you want to " - "save changes?".format(fname)), - buttons) - if answer == QMessageBox.Yes: - self.save_as(close=True) + self.save_notebook(client) if not is_welcome: client.shutdown_kernel() client.close() @@ -400,6 +382,41 @@ self.add_tab(client) return client + def save_notebook(self, client): + """ + Save notebook corresponding to given client. + + If the notebook is newly created and not empty, then ask the user for + a new filename and save under that name. + + This function is called when the user closes a tab. + """ + client.save() + + # Check filename to find out whether notebook is newly created + path = client.get_filename() + dirname, basename = osp.split(path) + if dirname != NOTEBOOK_TMPDIR or not basename.startswith('untitled'): + return + + # Read file to see whether notebook is empty + wait_save = QEventLoop() + QTimer.singleShot(1000, wait_save.quit) + wait_save.exec_() + nb_contents = nbformat.read(path, as_version=4) + if (len(nb_contents['cells']) == 0 + or len(nb_contents['cells'][0]['source']) == 0): + return + + # Ask user to save notebook with new filename + buttons = QMessageBox.Yes | QMessageBox.No + text = _("<b>{0}</b> has been modified.<br>" + "Do you want to save changes?").format(basename) + answer = QMessageBox.question( + self, self.get_plugin_title(), text, buttons) + if answer == QMessageBox.Yes: + self.save_as(close=True) + def save_as(self, name=None, close=False): """Save notebook as.""" current_client = self.get_current_client() @@ -412,8 +429,20 @@ filename, _selfilter = getsavefilename(self, _("Save notebook"), original_name, FILES_FILTER) if filename: - nb_contents = nbformat.read(original_path, as_version=4) - nbformat.write(nb_contents, filename) + try: + nb_contents = nbformat.read(original_path, as_version=4) + except EnvironmentError as error: + txt = (_("Error while reading {}<p>{}") + .format(original_path, str(error))) + QMessageBox.critical(self, _("File Error"), txt) + return + try: + nbformat.write(nb_contents, filename) + except EnvironmentError as error: + txt = (_("Error while writing {}<p>{}") + .format(filename, str(error))) + QMessageBox.critical(self, _("File Error"), txt) + return if not close: self.close_client(save=True) self.create_new_client(filename=filename) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-notebook-0.2.2/spyder_notebook/tests/test_plugin.py new/spyder-notebook-0.2.3/spyder_notebook/tests/test_plugin.py --- old/spyder-notebook-0.2.2/spyder_notebook/tests/test_plugin.py 2019-12-17 16:11:33.000000000 +0100 +++ new/spyder-notebook-0.2.3/spyder_notebook/tests/test_plugin.py 2020-03-13 14:03:55.000000000 +0100 @@ -11,6 +11,7 @@ import os import os.path as osp import shutil +import sys import tempfile # Third-party library imports @@ -25,6 +26,10 @@ # Local imports from spyder_notebook.notebookplugin import NotebookPlugin +# Python 2 compatibility +if sys.version_info[0] == 2: + PermissionError = OSError + # ============================================================================= # Constants # ============================================================================= @@ -177,6 +182,23 @@ assert not osp.exists(filename) +def test_close_nonexisting_notebook(notebook, qtbot): + """Test that we can close a tab if the notebook file does not exist. + Regression test for spyder-ide/spyder-notebook#187.""" + # Set up tab with non-existingg notebook + filename = osp.join(LOCATION, 'does-not-exist.ipynb') + notebook.open_notebook(filenames=[filename]) + nbwidget = notebook.get_current_nbwidget() + qtbot.waitUntil(lambda: prompt_present(nbwidget), timeout=NOTEBOOK_UP) + client = notebook.get_current_client() + + # Close tab + notebook.close_client() + + # Assert tab is closed (without raising an exception) + assert client not in notebook.clients + + @flaky(max_runs=3) def test_open_notebook(notebook, qtbot, tmpdir_under_home): """Test that a notebook can be opened from a non-ascii directory.""" @@ -202,6 +224,8 @@ @flaky(max_runs=3) +@pytest.mark.skipif(not sys.platform.startswith('linux'), + reason='Test hangs on CI on Windows and MacOS') def test_save_notebook(notebook, qtbot, tmpdir): """Test that a notebook can be saved.""" # Wait for prompt @@ -237,6 +261,28 @@ assert notebook.get_current_client().get_short_name() == "save" +def test_save_notebook_as_with_error(mocker, notebook, qtbot, tmpdir): + """Test that errors are handled in save_as().""" + # Set up mocks + name = osp.join(str(tmpdir), 'save.ipynb') + mocker.patch('spyder_notebook.notebookplugin.getsavefilename', + return_value=(name, 'ignored')) + mocker.patch('spyder_notebook.notebookplugin.nbformat.write', + side_effect=PermissionError) + mock_critical = mocker.patch('spyder_notebook.notebookplugin.QMessageBox' + '.critical') + + # Wait for prompt + nbwidget = notebook.get_current_nbwidget() + qtbot.waitUntil(lambda: prompt_present(nbwidget), timeout=NOTEBOOK_UP) + + # Save the notebook + notebook.save_as() + + # Assert that message box is displayed (reporting error raised by write) + assert mock_critical.called + + @flaky(max_runs=3) def test_new_notebook(notebook, qtbot): """Test that a new client is really a notebook.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spyder-notebook-0.2.2/spyder_notebook.egg-info/PKG-INFO new/spyder-notebook-0.2.3/spyder_notebook.egg-info/PKG-INFO --- old/spyder-notebook-0.2.2/spyder_notebook.egg-info/PKG-INFO 2020-02-26 13:35:10.000000000 +0100 +++ new/spyder-notebook-0.2.3/spyder_notebook.egg-info/PKG-INFO 2020-03-21 19:36:20.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: spyder-notebook -Version: 0.2.2 +Version: 0.2.3 Summary: Jupyter notebook integration with Spyder Home-page: https://github.com/spyder-ide/spyder-notebook Author: Spyder Development Team