Hi All,
I’ve been working on adding support for using Pike language code in Jupyter[1] and thought I’d share some of my progress. Jupyter is an interactive computing environment that’s become quite popular in the education and scientific communities. While Jupyter originated in the Python world and remains heavily python focused, support is available for a fairly wide range of other languages. A “kernel” is the bit of the Jupyter infrastructure that provides support for a given language and with an appropriate kernel implementation, it’s possible to switch between various languages in a fairly seamless manner.
A kernel for the pike language has actually existed[2] for a while, using an “IPython” wrapper around hilfe. I wanted to take support some more advanced features so I wrote a native kernel[3] that speaks the juypter kernel protocol.
I would consider this code to be proof of concept quality, but I have been using it over the past few months. I’ve learned quite a bit and will probably do a fair amount of restructuring at some point soon. I also had to make some (pretty minor) changes to Hilfe to get everything working. I’ll begin the process of integrating that work back into Pike in the near future.
Features:
- Code evaluation (the Hilfe we all know and love).
- Code auto-completion (ie, hitting tab provides a pop-up of options).
- Stdout and stderr are displayed as such in Jupyter.
- Support for multiple sessions, a separate pike evaluator is spawned for each one.
- Evaluations can return “rich” data, such as HTML or images. This can be used as building blocks for more advanced applications.
I’ve also created a demo repository[4] that can be used with juypter-repo2docker to build and launch a Pike-Jupyter session in a docker container. The demo repository includes a “notebook” with some simple demonstrations of the functionality. There is a link in the readme that can be used to spawn a new session in
MyBinder.org, so you can try it out without any actual work.
I like the idea of being able add a little presentation and permanence around my ad-hoc hilfe sessions. Obviously, if you look at some of the Jupyter demos, there’s a lot of missing functionality around fancy presentation of data and UI widgets, but I think that would be fairly simple to add (sadly, it seems the Juypter design pushes that functionality to the Kernel, so every language has to implement all of that).
As always, comments, feedback and code contributions are welcome!
Bill