import re import sys from visualstudio_py_repl import BasicReplBackend, ReplBackend, UnsupportedReplException, _command_line_to_args_list try: import thread except: import _thread as thread # Renamed as Py3k from base64 import decodestring try: import IPython except ImportError: exc_value = sys.exc_info()[1] raise UnsupportedReplException('IPython mode requires IPython 0.11 or later: ' + str(exc_value)) def is_ipython_versionorgreater(major, minor): """checks if we are at least a specific IPython version""" match = re.match('(\d+).(\d+)', IPython.__version__) if match: groups = match.groups() if int(groups[0]) > major: return True elif int(groups[0]) == major: return int(groups[1]) >= minor return False if is_ipython_versionorgreater(3, 0): raise UnsupportedReplException('IPython 3.0 is not yet supported. See http://pytools.codeplex.com/workitem/2961')
import re import sys from visualstudio_py_repl import BasicReplBackend, ReplBackend, UnsupportedReplException, _command_line_to_args_list try: import thread except: import _thread as thread # Renamed as Py3k from base64 import decodestring try: import IPython except ImportError: exc_value = sys.exc_info()[1] raise UnsupportedReplException( 'IPython mode requires IPython 0.11 or later: ' + str(exc_value)) def is_ipython_versionorgreater(major, minor): """checks if we are at least a specific IPython version""" match = re.match('(\d+).(\d+)', IPython.__version__) if match: groups = match.groups() if int(groups[0]) > major: return True elif int(groups[0]) == major: return int(groups[1]) >= minor return False
"""Implements REPL support over IPython/ZMQ for VisualStudio""" from visualstudio_py_repl import BasicReplBackend, ReplBackend, UnsupportedReplException try: from IPython.zmq import kernelmanager from IPython.zmq.kernelmanager import XReqSocketChannel, KernelManager, SubSocketChannel, RepSocketChannel, HBSocketChannel from IPython.utils.traitlets import Type except ImportError: raise UnsupportedReplException('IPython mode requires IPython 0.11 or later.') import thread # TODO: SystemExit exceptions come back to us as strings, can we automatically exit when ones raised somehow? x = [] ##### # Channels which forward events # Description of the messaging protocol # http://ipython.scipy.org/doc/manual/html/development/messaging.html def unknown_command(content): import pprint pprint.pprint(content) class DefaultHandler(object): def call_handlers(self, msg): # msg_type: # execute_reply msg_type = 'handle_' + msg['msg_type']