[Python-modules-commits] [jupyter-console] 01/10: Imported Upstream version 5.2.0

Gordon Ball chronitis-guest at moszumanska.debian.org
Mon Aug 28 20:37:36 UTC 2017


This is an automated email from the git hooks/post-receive script.

chronitis-guest pushed a commit to branch master
in repository jupyter-console.

commit 43a9d79b86af1c8bb09a24591bf7c466314ce18c
Author: Gordon Ball <gordon at chronitis.net>
Date:   Wed Aug 23 19:21:16 2017 +0200

    Imported Upstream version 5.2.0
---
 PKG-INFO                    |  2 +-
 docs/changelog.rst          | 28 ++++++++++++++++++++--------
 docs/conf.py                |  3 +++
 docs/requirements.txt       |  1 +
 jupyter_console/_version.py |  2 +-
 jupyter_console/ptshell.py  | 34 ++++++++++++++++++++++++++++------
 6 files changed, 54 insertions(+), 16 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 5ecc2a7..e319c6e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: jupyter_console
-Version: 5.1.0
+Version: 5.2.0
 Summary: Jupyter terminal console
 Home-page: https://jupyter.org
 Author: Jupyter Development Team
diff --git a/docs/changelog.rst b/docs/changelog.rst
index b61c320..7d837b0 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -3,6 +3,17 @@ Changes in Jupyter console
 
 A summary of changes in Jupyter console releases.
 
+5.2
+---
+
+- When using a kernel that the console did not start, exiting with Ctrl-D now
+  leaves it running. :ghpull:`127`
+- Added Ctrl-\\ shortcut to quit the console. :ghpull:`130`
+- Input prompt numbers are now updated when another frontend has executed
+  code in the same kernel. :ghpull:`119`
+- Fix setting next input with newer versions of prompt_toolkit. :ghpull:`123`
+- Ensure history entries are unicode, not bytes, on Python 2. :ghpull:`122`
+
 5.1
 ---
 
@@ -24,20 +35,21 @@ A summary of changes in Jupyter console releases.
 
 Interactive Shell architecture
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-- disinherit shell class from IPython Interactive Shell `#68 <https://github.com/jupyter/jupyter_console/pull/68>`_
-  This separates jupyter_console's ZMQTerminalInteractiveShell from IPython's TerminalInteractiveShell and InteractiveShell classes.
-- update SIGINT handler to not use the old interactive API shell `#80 <https://github.com/jupyter/jupyter_console/pull/80>`_
+- Disinherit shell class from IPython Interactive Shell (:ghpull:`68`).
+  This separates jupyter_console's ``ZMQTerminalInteractiveShell`` from
+  IPython's ``TerminalInteractiveShell`` and ``InteractiveShell`` classes.
+- Update SIGINT handler to not use the old interactive API shell. :ghpull:`80`
 
 Image Handling improvement
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
-- use PIL as default image handler `#79 <https://github.com/jupyter/jupyter_console/pull/79>`_
-- better indication of whether image data was handled `#77 <https://github.com/jupyter/jupyter_console/pull/77>`_
+- use PIL as default image handler :ghpull:`79`
+- better indication of whether image data was handled :ghpull:`77`
 
 Prompts improvement
 ^^^^^^^^^^^^^^^^^^^
-- use prompt_toolkit 1.0 `#74 <https://github.com/jupyter/jupyter_console/pull/74>`_
-- don't use prompt_manager `#75 <https://github.com/jupyter/jupyter_console/pull/75>`_
-- remove ``colors_force`` flag that have no effects: `#88 <https://github.com/jupyter/jupyter_console/pull/88>`_
+- use prompt_toolkit 1.0 :ghpull:`74`
+- don't use prompt_manager :ghpull:`75`
+- remove ``colors_force`` flag that have no effects: :ghpull:`88`
 
 4.1
 ---
diff --git a/docs/conf.py b/docs/conf.py
index 95c633e..1a432bf 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -44,8 +44,11 @@ if os.environ.get('READTHEDOCS', ''):
 # ones.
 extensions = [
     'sphinx.ext.intersphinx',
+    'sphinxcontrib_github_alt',
 ]
 
+github_project_url = "https://github.com/jupyter/jupyter_console"
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 52d1a39..bf72812 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -3,3 +3,4 @@ ipython
 jupyter_core
 jupyter_client
 sphinx
+sphinxcontrib_github_alt
diff --git a/jupyter_console/_version.py b/jupyter_console/_version.py
index 4f23444..5684ba6 100644
--- a/jupyter_console/_version.py
+++ b/jupyter_console/_version.py
@@ -5,6 +5,6 @@ the beta released i.e. 1, 2, 3 ...
 See PEP 440 https://www.python.org/dev/peps/pep-0440/
 """
 
-version_info = (5, 1, 0)
+version_info = (5, 2, 0)
 
 __version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:])
diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py
index 04edd52..35959d1 100644
--- a/jupyter_console/ptshell.py
+++ b/jupyter_console/ptshell.py
@@ -30,6 +30,7 @@ from .zmqhistory import ZMQHistoryManager
 from . import __version__
 
 from prompt_toolkit.completion import Completer, Completion
+from prompt_toolkit.document import Document
 from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
 from prompt_toolkit.filters import HasFocus, HasSelection, ViInsertMode, EmacsInsertMode
 from prompt_toolkit.history import InMemoryHistory
@@ -122,6 +123,7 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable):
     _execution_state = Unicode('')
     _pending_clearoutput = False
     _eventloop = None
+    own_kernel = False  # Changed by ZMQTerminalIPythonApp
 
     editing_mode = Unicode('emacs', config=True,
         help="Shortcut style to use at the prompt. 'vi' or 'emacs'.",
@@ -358,6 +360,10 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable):
                 b.newline()
                 return
 
+            # Pressing enter flushes any pending display. This also ensures
+            # the displayed execution_count is correct.
+            self.handle_iopub()
+
             more, indent = self.check_complete(d.text)
 
             if (not more) and b.accept_action.is_returnable:
@@ -369,13 +375,17 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable):
         def _(event):
             event.current_buffer.reset()
 
+        @kbmanager.registry.add_binding(Keys.ControlBackslash, filter=HasFocus(DEFAULT_BUFFER))
+        def _(event):
+            raise EOFError
+
         # Pre-populate history from IPython's history database
         history = InMemoryHistory()
         last_cell = u""
         for _, _, cell in self.history_manager.get_tail(self.history_load_length,
                                                         include_latest=True):
             # Ignore blank lines and consecutive duplicates
-            cell = cell.rstrip()
+            cell = cast_unicode_py2(cell.rstrip())
             if cell and (cell != last_cell):
                 history.append(cell)
 
@@ -460,11 +470,19 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable):
 
     def pre_prompt(self):
         if self.next_input:
-            b = self.pt_cli.application.buffer
-            b.text = cast_unicode_py2(self.next_input)
+            # We can't set the buffer here, because it will be reset just after
+            # this. Adding a callable to pre_run_callables does what we need
+            # after the buffer is reset.
+            s = cast_unicode_py2(self.next_input)
+            def set_doc():
+                self.pt_cli.application.buffer.document = Document(s)
+            if hasattr(self.pt_cli, 'pre_run_callables'):
+                self.pt_cli.pre_run_callables.append(set_doc)
+            else:
+                # Older version of prompt_toolkit; it's OK to set the document
+                # directly here.
+                set_doc()
             self.next_input = None
-            # Move the cursor to the end
-            b.cursor_position += b.document.get_end_of_document_position()
 
     def interact(self, display_banner=None):
         while self.keep_running:
@@ -482,7 +500,7 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable):
                     self.run_cell(code, store_history=True)
 
     def mainloop(self):
-        self.keepkernel = False
+        self.keepkernel = not self.own_kernel
         # An extra layer of protection in case someone mashing Ctrl-C breaks
         # out of our internal code.
         while True:
@@ -663,6 +681,10 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable):
             msg_type = sub_msg['header']['msg_type']
             parent = sub_msg["parent_header"]
 
+            # Update execution_count in case it changed in another session
+            if msg_type == "execute_input":
+                self.execution_count = int(sub_msg["content"]["execution_count"]) + 1
+
             if self.include_output(sub_msg):
                 if msg_type == 'status':
                     self._execution_state = sub_msg["content"]["execution_state"]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/jupyter-console.git



More information about the Python-modules-commits mailing list