[IPython-dev] kernel wrapper example

Thomas Kluyver takowl at gmail.com
Mon Jul 21 14:44:50 EDT 2014


On 21 July 2014 05:02, Ralf Hemmecke <hemmecke at gmail.com> wrote:

> 1) Into which directory should I put echokernel.py?
>

Anywhere that you could import it. For testing, having it in the working
directory when you start IPython should work.


> 2) where should I put this kernel.json snippet?
>

Make a directory ~/.ipython/kernels/echo/ , and save kernel.json in there.
As Matthias said, this is a new mechanism - you will need the development
version of IPython to use it - and it's not properly documented yet. I will
write some docs.


> 3) I'd expect that then (when I simply call "ipython") it would
>    automatically use "echokernel.py". Is this true?
>

Not quite. Firstly, the idea is that you can have several of these kernel
specifications, so you need to tell it which one to use. For 'ipython
console' and 'ipython qtconsole', you can start them with a '--kernel echo'
argument. The name is the last part of the directory path where you saved
kernel.json. In the notebook, there will be a dropdown menu to select from
the available kernels - that's in development in PR 6126:
https://github.com/ipython/ipython/pull/6126

If you just type 'ipython', it's a single process running your code, not a
frontend communicating with a kernel, so it can't use a different kernel.
You can use 'ipython console' to get a similar terminal interface which
does talk to a kernel.

Matthias already pointed you to my bash_kernel, which I wrote partly as an
example of how to do this kind of thing.

Thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140721/f1c4e592/attachment.html>


More information about the IPython-dev mailing list