[IPython-dev] zmq when using ipython

Jason Grout jason-sage at creativetrax.com
Fri Apr 13 01:43:40 EDT 2012


On 4/12/12 10:48 PM, Fernando Perez wrote:
> On Thu, Apr 12, 2012 at 7:47 AM, Jason Grout
> <jason-sage at creativetrax.com>  wrote:
>> Thanks, this corrects a big misunderstanding I had (and maybe is also an
>> answer to Volker's post).  I thought *everything* in the new ipython
>> depended on the messaging protocol and connections with zmq.
>
> The biggest change for Sage is going to be that customizing IPython
> now uses a richer but also more complex configuration system:
>
> http://ipython.org/ipython-doc/dev/config/index.html
>
> It appears a bit daunting at first, and it does have a few rough
> edges, but by and large we've found that it works very well in letting
> us configure all the many moving parts IPython now has while using the
> full power of the Python language (since the config files are regular
> .py).
>
> It's *possible* that we've removed/forgotten something that Sage used
> in its command-line client.  If that's the case let us know, as we
> didn't intend to remove any of the features that made the kind of
> aggressive customization Sage does impossible.  Such a change would be
> just an accidental oversight, so just report it and we'll do our best
> to restore any missing functionality.
>

Mike Hansen posted a working patch for the latest Sage build: 
http://trac.sagemath.org/sage_trac/ticket/12719

I've been using it for about a day now, and haven't noticed any real 
problems.

I'm also interested in the forking issue.  With the Sage Cell Server 
[1], we end up forking a running Sage instance to create a new worker 
process (i.e., kernel).  We're still thinking through the design and how 
we can best take advantage of the new IPython functionality, so I'll 
probably have more coherent questions later.  However, one feature we'd 
love to see is allowing user code to send messages in the same channel 
as normal output messages.  For example, I'd like to send the following 
message, which our custom IPython client already interprets to make a 
Sage interact with javascript controls:

{"msg_type": "interact_prepare",
  "content": {"interact_id": "2096051932116277084",
              "layout": {"top_center": ["n"]},
              "update": {"n": ["n"]},
              "controls": {"n": {"control_type": "slider", "raw": true, 
"default": 0.0, "step": 0.004, "label": null, "subtype": "continuous", 
"range": [0.0, 1.0], "display_value": true}}
             }
}

Last year, we talked about wrapping such user messages so that the 
message the client would actually see this:

{"header": {...},
"parent_header": {...},
"msg_type": "extension",
"content": user_message, # message above
}

Is there a way to send such messages from userspace code?

Thanks,

Jason



More information about the IPython-dev mailing list