From 6c9c2ae4281ec584e5d7d93c4dfabe19b7f39de4 2014-08-12 18:57:13 From: Thomas Kluyver Date: 2014-08-12 18:57:13 Subject: [PATCH] Document is_complete messages Also, bump message spec version --- diff --git a/IPython/core/release.py b/IPython/core/release.py index 822b940..065d8f3 100644 --- a/IPython/core/release.py +++ b/IPython/core/release.py @@ -40,7 +40,7 @@ version = __version__ # backwards compatibility name version_info = (_version_major, _version_minor, _version_patch, _version_extra) # Change this when incrementing the kernel protocol version -kernel_protocol_version_info = (5, 0) +kernel_protocol_version_info = (5, 1) kernel_protocol_version = "%i.%i" % kernel_protocol_version_info description = "IPython: Productive Interactive Computing" diff --git a/docs/source/development/messaging.rst b/docs/source/development/messaging.rst index f43b137..4d6e1b9 100644 --- a/docs/source/development/messaging.rst +++ b/docs/source/development/messaging.rst @@ -9,7 +9,7 @@ Versioning ========== The IPython message specification is versioned independently of IPython. -The current version of the specification is 5.0. +The current version of the specification is 5.1. Introduction @@ -573,6 +573,35 @@ Message type: ``history_reply``:: 'history' : list, } +.. _msging_is_complete: + +Code completeness +----------------- + +.. versionadded:: 5.1 + +When the user enters a line in a console style interface, the console must +decide whether to immediately execute the current code, or whether to show a +continuation prompt for further input. For instance, in Python ``a = 5`` would +be executed immediately, while ``for i in range(5):`` would expect further input. + +Frontends may have ways to override this, forcing the code to be sent for +execution or forcing a continuation prompt. If the kernel does not reply promptly, +the frontend will probably default to sending the code to be executed. + +Message type: ``is_complete_request``:: + + content = { + # The code entered so far as a multiline string + 'code' : str, + } + +Message type: ``complete_reply``:: + + content = { + # True if the code is ready to execute, False if not + 'complete' : bool, + } Connect ------- diff --git a/docs/source/development/wrapperkernels.rst b/docs/source/development/wrapperkernels.rst index a8817a0..3e1db4e 100644 --- a/docs/source/development/wrapperkernels.rst +++ b/docs/source/development/wrapperkernels.rst @@ -141,6 +141,17 @@ relevant section of the :doc:`messaging spec `. :ref:`msging_history` messages + .. method:: do_is_complete(code) + + Is code entered in a console-like interface complete and ready to execute, + or should a continuation prompt be shown? + + :param str code: The code entered so far - possibly multiple lines + + .. seealso:: + + :ref:`msging_is_complete` messages + .. method:: do_shutdown(restart) Shutdown the kernel. You only need to handle your own clean up - the kernel