[IPython-dev] ITorch on IPython 3 -- problems?

Andrew Payne andy at payne.org
Sat Feb 21 13:35:37 EST 2015


On getting iTorch working with IPython 3.0:

> I didn’t play with it too much, but I submitted a couple of PRs
> <https://github.com/facebook/iTorch/pulls?q=is%3Apr+author%3Aminrk> to
> get iTorch working with IPython 3.0 last week. After those, it seemed to be
> working for me.
>
I've dug into this more deeply and now I'm wondering how you got it working.

The iTorch kernel uses kernel messaging v4 (properly reported after your
PR). It uses 'pyout' messages to send stdout.

When sending the messages, iTorch copies the header from the received
message, including whatever 'version' field is in there.  See:
https://github.com/facebook/iTorch/blob/master/IOHandler.lua#L73

IPython 3 seems to send execute_request messages with it's current version
setting, 5.0.  This causes iTorch to reply with a 'pyout' message tagged as
version 5.0.  Which in turn, causes IPython to skip adapting the message to
v5 (since it already thinks it's v5, in kernel/adapter.py).  And since
'pyout' is not in v5, it dropped the message on the floor.

(I've opened a PR to fix this in iTorch by always setting the version to
4.0, see:  https://github.com/facebook/iTorch/pull/28)

However, it raises questions:

   - Should IPython be sending v5 messages to a kernel that advertises v4?

   - Should the kernel messaging code be more verbose (log.warn, or
   something) when it gets a message type it doesn't understand?

-andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150221/3ef54358/attachment.html>


More information about the IPython-dev mailing list