[IPython-dev] Simple Kernel Example

Andrew Gibiansky andrew.gibiansky at gmail.com
Thu Jan 23 17:11:15 EST 2014


IPython --debug would have saved me so many hours. Dear lord I can't
believe I didn't know about that flag. Thank you thank you thank you.

-- Andrew Gibiansky


On Thu, Jan 23, 2014 at 3:04 PM, Matthias BUSSONNIER <
bussonniermatthias at gmail.com> wrote:

>
> Le 23 janv. 2014 à 14:47, Doug Blank a écrit :
>
> > On Tue, Jan 21, 2014 at 12:41 PM, Doug Blank <doug.blank at gmail.com>
> wrote:
> >> On Mon, Jan 20, 2014 at 12:01 PM, Matthias BUSSONNIER
> >> <bussonniermatthias at gmail.com> wrote:
> >>
> >> [snip]
> >>
> >>>>> Haven't looked at your simple_kernel.py yet.
> >>>>
> >>>> I have cleaned up the code some, but as far as I can tell, nothing is
> working.
> >>>
> >>> I'm not sure sockets like passing between threads.
> >>> And I think kernel side should use bind instead of connect because
> there is an asymetrie in req/res and pub/sub
> >>
> >> Thanks for the feedback... your comments help me realize that I was
> >> looking at the wrong side of the socket code as examples. I've made
> >> more progress, but still looking for help on the code:
> >>
> >> https://github.com/dsblank/simple_kernel
> >
> > Thanks to hints given, I now have a working, simple_kernel.py.
>
> Yeahhh
>
>
> > No one
> > from IPython has looked at that yet, so I don't know if there are
> > issues, let alone if this is best practices. But it does work.
>
> You were not **really** stuck :-)
>
> >
> > Questions still:
> >
> >> Some specific questions:
> >>
> >> 1) Does the kernel need to handle the "ident" bytes on the front end
> >> of messages before the delimiter? I see a couple of options: a) ignore
> >> them, b) pass them back with responses, c) do something with them?
> >> What do they represent?
> >
> > It looks like the ident bytes on the front are a type of routing info
> > in the form of "username.engine_id.message_id". I have ignored them so
> > far. Am I losing functionality if I don't send them?
>
> Ident might be used only to avoid replay attack, don't remember.
> Jump on hip chat and ping @minrk, he is the one with the more
>  knowledge of msg spec I think.
>
> >
> >> 2) Could someone provide an example of a execute_request/execute_reply
> >> exchange of messages. I'm having trouble getting the conversation to
> >> work. Specifically, looking for how execute_reply, pyout, pyin
> >> message_types are related, and which sockets they are sent on.
> >
>
> start IPython with --debug, you should see the messages comming one going
> printed to stderr
>
> > I now have that working. Errors that I had: using socket.connect() vs
> > socket.bind(), not flushing the stream when sending, using wrong
> > zmq.MODE (DEALER, PUB, SUB, etc) when creating the socket, missing
> > JSON fields, and using the wrong socket (ie, "channel"). To solve
> > these issues I put some print statements in IPython/kernel/channels.py
> > when sending and recving and mirrored these details.
>
> if you think those are needed you could put log.debug statement and open a
> PRs
>
> >
> > The documentation is good, but I find that examples of the messages
> > being exchanged to be useful to make it concrete. Also, it seems that
> > some details are not specified in the docs.
>
> Please open Issues on github and/or PR that how things will move forward
> on the doc :-)
>
> > I'll continue to make simple_kernel better, if I receive feedback or
> > add to it. Now, I'm ready to implement my real goal in C#...
>
> Nice, is F# a derivative on C# ?
> https://github.com/BayardRock/IfSharp
>
> Microsoft integrate IPython with visual studio, maybe they have some
> pieces Public in C# ?
>
> Is there a list of IPython  kernels somewhere ? Maybe we should create a
> page on the Wiki.
>
> You could try to run your kernel again the test-suite, it could give you
> hint if things are missing.
>
> --
> Matthias
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140123/1fe9defc/attachment.html>


More information about the IPython-dev mailing list