How to use the jupyter.swift_kernel.SwiftKernel function in jupyter

To help you get started, we’ve selected a few jupyter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tensorflow / swift / jupyter / swift_kernel.py View on Github external
'evalue': '',
                'traceback': [result.error.description],
            })

            return {
                'status': 'error',
                'execution_count': self.execution_count,
                'ename': '',
                'evalue': '',
                'traceback': [result.error.description],
            }


if __name__ == '__main__':
    from ipykernel.kernelapp import IPKernelApp
    IPKernelApp.launch_instance(kernel_class=SwiftKernel)
github tensorflow / swift / jupyter / swift_kernel.py View on Github external
def __init__(self, **kwargs):
        super(SwiftKernel, self).__init__(**kwargs)

        self.debugger = lldb.SBDebugger.Create()
        self.debugger.SetAsync(False)
        if not self.debugger:
            raise Exception('Could not start debugger')

        # LLDB crashes while trying to load some Python stuff on Mac. Maybe
        # something is misconfigured? This works around the problem by telling
        # LLDB not to load the Python scripting stuff, which we don't use
        # anyways.
        self.debugger.SetScriptLanguage(lldb.eScriptLanguageNone)

        repl_swift = os.environ['REPL_SWIFT_PATH']
        self.target = self.debugger.CreateTargetWithFileAndArch(repl_swift, '')
        if not self.target:
            raise Exception('Could not create target %s' % repl_swift)