from __future__ import print_function

from jupyter_kernel import MagicKernel
import os

class EvalKernel(MagicKernel):
    implementation = 'Eval'
    implementation_version = '1.0'
    language = 'python'
    language_version = '0.1'
    banner = "Eval kernel - evaluates simple Python statements and expressions"
    env = {}

    def get_usage(self):
        return "This is a usage statement."

    def set_variable(self, name, value):
        """
        Set a variable in the kernel language.
        """
        self.env[name] = value

    def get_kernel_help_on(self, expr, level):
        return "Sorry, no help is available on '%s'." % expr

    def do_execute_direct(self, code):
        try:
            return eval(code.strip(), self.env)
        except:
            try:
                exec code.strip() in self.env
            except:
                return "Error: " + code

if __name__ == '__main__':
    from IPython.kernel.zmq.kernelapp import IPKernelApp
    IPKernelApp.launch_instance(kernel_class=EvalKernel)

@@ -75,17 +75,8 @@
 nel%0A
-import os
 %0A%0Acl
@@ -544,343 +544,635 @@
 get_
-kernel_help_on(self, expr, level):%0A        return %22Sorry, no help is
+variable(self, name):%0A        %22%22%22%0A        Get
  a
+ 
 va
+r
 i
-l
 able 
-on '%25s'.%22 %25 expr%0A%0A    def do_execute_direct(self, code):%0A        try:%0A            return eval(code.strip(), self.env)%0A        except:%0A            try:%0A                exec code.strip() in self.env%0A            except:%0A                return %22Error: %22 + code
+from the kernel language.%0A        %22%22%22%0A        return self.env.get(name, None)%0A%0A    def do_execute_direct(self, code):%0A        python_magic = self.line_magics%5B'python'%5D%0A        resp = python_magic.eval(code.strip())%0A        if not resp is None:%0A            self.Print(str(resp))%0A%0A    def get_completions(self, token):%0A        python_magic = self.line_magics%5B'python'%5D%0A        return python_magic.get_completions(token)%0A%0A    def get_kernel_help_on(self, expr, level=0):%0A        python_magic = self.line_magics%5B'python'%5D%0A        return python_magic.get_help_on(expr, level)
 %0A%0Aif

Update eval kernel to use python magic.