Permalink
Browse files

Change version protocol according to the discussion in #2649

  • Loading branch information...
1 parent 8d48684 commit 90ce3685778cda2fa5bfe575ea51c50483b8012e @tkf committed Dec 12, 2012
Showing with 15 additions and 11 deletions.
  1. +8 −8 IPython/zmq/ipkernel.py
  2. +3 −0 IPython/zmq/session.py
  3. +4 −3 IPython/zmq/tests/test_message_spec.py
View
@@ -35,6 +35,7 @@
from zmq.eventloop.zmqstream import ZMQStream
# Local imports
+import IPython
from IPython.config.configurable import Configurable
from IPython.config.application import boolean_flag, catch_config_error
from IPython.core.application import ProfileDir
@@ -53,18 +54,16 @@
from entry_point import base_launch_kernel
from kernelapp import KernelApp, kernel_flags, kernel_aliases
from serialize import serialize_object, unpack_apply_message
-from session import Session, Message
+from session import Session, Message, protocol_version
from zmqshell import ZMQInteractiveShell
#-----------------------------------------------------------------------------
# Main kernel class
#-----------------------------------------------------------------------------
-# Change this when incrementing the kernel protocol version
-version_major = 1
-version_minor = 1
-version = '{0}.{1}'.format(version_major, version_minor)
+ipython_version = list(IPython.version_info)
+language_version = list(sys.version_info[:3])
class Kernel(Configurable):
@@ -518,9 +517,10 @@ def connect_request(self, stream, ident, parent):
def version_request(self, stream, ident, parent):
vinfo = {
- 'version': version,
- 'version_major': version_major,
- 'version_minor': version_minor,
+ 'protocol_version': protocol_version,
+ 'ipython_version': ipython_version,
+ 'language_version': language_version,
+ 'language': 'python',
}
msg = self.session.send(stream, 'version_reply',
vinfo, parent, ident)
View
@@ -75,6 +75,9 @@ def squash_unicode(obj):
# globals and defaults
#-----------------------------------------------------------------------------
+# Change this when incrementing the kernel protocol version
+protocol_version = [1, 1]
+
_version_info_list = list(IPython.version_info)
# ISO8601-ify datetime objects
json_packer = lambda obj: jsonapi.dumps(obj, default=date_default)
@@ -197,9 +197,10 @@ class CompleteReply(Reference):
class VersionReply(Reference):
- version = Enum((ipkernel.version))
- version_major = Enum((ipkernel.version_major,))
- version_minor = Enum((ipkernel.version_minor,))
+ protocol_version = Enum((ipkernel.protocol_version,))
+ ipython_version = Enum((ipkernel.ipython_version,))
+ language_version = Enum((ipkernel.language_version,))
+ language = Enum(("python",))
# IOPub messages

0 comments on commit 90ce368

Please sign in to comment.