Skip to content
Jupyter wire protocol implementation enabling D plugins to be jupyter kernels
D
Branch: master
Clone or download
John-Colvin Merge pull request #10 from symmetryinvestments/add-completion
Add auto-completion to Jupyter kernel for SIL
Latest commit d583c0b Sep 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example tidy up Sep 18, 2019
source/jupyter/wire only call complete on kernel if it exists Sep 18, 2019
tests Fix #1 - print usage Nov 12, 2018
.gitignore Ignore .dll files Apr 10, 2019
.travis.yml test newer compilers Sep 18, 2019
LICENSE Added READMEs Oct 4, 2018
README.md fix build status Jul 24, 2019
dub.sdl fix zmqd dep Sep 18, 2019

README.md

jupyter-wire

Build Status

An implementation of the Jupyter wire protocol in D.

This library was written so that any backend written in or callable by D can be a jupyter kernel. A backend must be a D type that satisfies the following compile-time interface:

import jupyter.wire.kernel: LanguageInfo, ExecutionResult;
LanguageInfo info = T.init.languageInfo;
ExecutionResult result = T.init.execute("foo");

For a backend type that doesn't require initialisation, the following code is sufficient:

struct MyBackend {
    enum languageInfo = LanguageInfo(/*...*/);
    ExecutionResult execute(in string code) {
       // ...
    }
}

import jupyter.wire.kernel: Main;
mixin Main!MyBackend;

Otherwise, initialise as necessary and call Kernel.run:

import jupyter.wire.kernel: kernel;
auto k = kernel(backend, connectionFileName);
k.run;

Please consult the example directory for a working (albeit silly) kernel.

Windows

Set the environment variables ZMQ_DIR_32 and/or ZMQ_DIR_64 for where to find the zmq.lib when building. Remember to copy the revelant .dll to the executable path.

Text and markdown output

To return text output, use the textResult helper function:

return textResult("this is the output", Stdout("This is stdout side-effect"));

Similarly for markdown output:

return markdownResult("# This is a header");

In both cases the Stdout parameter is optional.

You can’t perform that action at this time.