Git Product home page Git Product logo

jupyter-wire's Introduction

jupyter-wire

Build Status

An implementation of the Jupyter wire protocol in D. This depends on ZeroMQ so the relevant development library (zmq.dll, libzmq.so, ...) will have to be installed on the system for this to link.

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;

Examples

  • basic example shows a minimal kernel that responds to requests from the frontend.
  • widgets example shows how to can communicate with ipywidgets.

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.

jupyter-wire's People

Contributors

atilaneves avatar joequant avatar john-colvin avatar kaleidic avatar laeeth avatar skoppe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jupyter-wire's Issues

meson build tool

First thanks for your works

I would like to know if it is possible to support meson as build tool ?

thanks

best regard

Purpose of IoPubMessageSender in Examples

In all of the examples, the individual backend has scope IoPubMessageSender sender as a parameter for the execute function. It is never used.

In the README example, no such parameter exists.

Is it necessary? If yes, what is it purpose?

(I have also copy-pasted the basic example, and it did not compile, because the definition of IoPubMessageSender was missing. However this might not be true, as I was toying around with this package, and I might miss something.)

jupyter-wire magics integration with other languages (i.e. python)

I'm looking into ways of getting jupyter-wire to integrate dlang with other languages. The idea would be to do a calculation in d and then plotting the result with python.

Ideas:

  • using magics
  • using pyd and then passing the mime output back into jupyter-wire
  • using d's dsl functionality in weird and cool ways

Thoughts on the easiest way of integrating this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.