neugram / ng

scripting language integrated with Go
https://neugram.io
BSD 2-Clause "Simplified" License
916 stars 43 forks source link

ng: provide a Jupyter kernel #16

Open sbinet opened 6 years ago

sbinet commented 6 years ago

integrating ng with Jupyter would be great.

we'd need to implement a Jupyter kernel for ng to be able to do that.

crawshaw commented 6 years ago

Well the first problem is that Jupyter talks a protocol based on ZeroMQ.

This is not necessarily bad, ZeroMQ looks like a pretty good reliable-datagram protocol. But it makes for an awkward start because the popular way to use it in Go appears to be by using a cgo wrapper around the C++ library.

A cgo library would be an unpleasant dependency to add to the ng binary. So that means we can make the jupyter kernel be a separate binary, which is a bit awkward, or try to talk ZMTP directly from Go.

Digging around brought me to https://github.com/zeromq/gomq, a pure Go implementation. I haven't worked out exactly what version of ZMTP it talks, or whether it is compatible with Jupyter. (Though I note @sbinet's name in the contributor list!) I'm not very familiar with the license (MPL), but it looks like it would be fine to have in the vendor directory. So I'm going to try it out and see if it's in good enough shape for jupyter.

sbinet commented 6 years ago

yeah... that's something I hit when trying to streamline the gophernotes installation procedure.

I had also started (for something loosely connected to my dayjob) a pure-Go implementation of ZeroMQ on top of the pure-Go implementation of nanomsg. it stalled at some point, but it's here: https://github.com/sbinet-alice/zmq

crawshaw commented 6 years ago

I'm a little confused. Is that zmq over a different transport? I'm assuming that's not what jupyter talks, it looks like zmq over TCP. But maybe I've missed something obvious?

Did you have any luck using gomq for gophernotes?

sbinet commented 6 years ago

apologies for the confusion. sbinet-alice/zmq is/was an attempt at reusing the whole machinery of network topologies already implemented by mangos and tacking an implementation of ZeroMQ on top (so, naively, just implementing zmtp in terms of mangos building block and call it a day. I was naive.)

I haven't tried gomq for gophernotes (yet?).

crawshaw commented 6 years ago

Gotcha.

I've got the gomq zmtp package exchanging the first handshake with jupyter for neugram, using a forked copy that supports routers and multi-part messages. If I can get hello world working I'll commit it.