(thanks to Jonathan Frederic for last minute presentation shortcuts)
"Why should I care?"
Implement one piece - and get the others for free.
(free as in BSD)
Interactive Computing Communication Protocol
I wanted "IPython Protocol"
"Interactive Computing Protocol"
kernel
In brief, read the messaging spec for more details.
Essential fields:
header:
msg_id:
msg_type: execute_request, execute_reply, object_info_request,
complete_request, complete_reply, history_request, ...
parent_header: (see above)
content: structure depends on message type
example: `execute_request`
- `code` (str)
- `silent` (bool)
- `store_history` (bool)
example: `execute_reply`
- `status` ('ok', 'error', or 'abort')
- `execution count` (prompt numbers)
Differences in
I have a serious illness: chronic CLI.
It's terminal.
— Paul Ivanov (@ivanov) May 3, 2014
ipython qtconsole
- the original decoupling, uses Qt4
ipython console
- terminal version, decoupled
ipython
)both of these actually start a kernel and a client,
pass --existing
flag to not start a new kernel
and instead simply connect to one that already
exists
ipython notebook
♦ ♦ - more on this later
vim plugin first written during the sprints at SciPy 2011
Vim needs to be compiled with Python support (vim --version | grep +python
)
AND the Python linked must have IPython with ZeroMQ support
HOWEVER: the Python linked does not need to be your preferred Python.
Solution: either install IPython and PyZMQ into system Python, or compile vim against a Python which has IPython and PyZMQ (Python that comes with Anaconda, for example)
In any Python code you have lying around, do this:
import IPython; IPython.embed_kernel()
When that code runs, it will prompt something like this:
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.
To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.
To read more about this, see https://github.com/ipython/ipython/issues/2049
To connect another client to this kernel, use:
--existing kernel-5979.json
(demo if time permits)
You favorite tool can talk (bi-directionally) to Python!
ICCP over zermoq happens over multiple channels (3) not just one. - stdin - Shell ( action requests: execution, object introspection, code completion ) - IOPub ( "broadcast channel" )
see sequence diagram
import IPython.display as d
d.IFrame("/files/notebook-as-proxy.html", 800, 600)