This documentation is for an old version of IPython. You can find docs for newer versions here.

Module: kernel.zmq.serialize

serialization utilities for apply messages

4 Functions

IPython.kernel.zmq.serialize.serialize_object(obj, buffer_threshold=1024, item_threshold=64)

Serialize an object into a list of sendable buffers.


obj : object

The object to be serialized

buffer_threshold : int

The threshold (in bytes) for pulling out data buffers to avoid pickling them.

item_threshold : int

The maximum number of items over which canning will iterate. Containers (lists, dicts) larger than this will be pickled without introspection.


[bufs] : list of buffers representing the serialized object.

IPython.kernel.zmq.serialize.deserialize_object(buffers, g=None)

reconstruct an object serialized by serialize_object from data buffers.


bufs : list of buffers/bytes

g : globals to be used when uncanning


(newobj, bufs) : unpacked object, and the list of remaining unused buffers.

IPython.kernel.zmq.serialize.pack_apply_message(f, args, kwargs, buffer_threshold=1024, item_threshold=64)

pack up a function, args, and kwargs to be sent over the wire

Each element of args/kwargs will be canned for special treatment, but inspection will not go any deeper than that.

Any object whose data is larger than threshold will not have their data copied (only numpy arrays and bytes/buffers support zero-copy)

Message will be a list of bytes/buffers of the format:

[ cf, pinfo, <arg_bufs>, <kwarg_bufs> ]

With length at least two + len(args) + len(kwargs)

IPython.kernel.zmq.serialize.unpack_apply_message(bufs, g=None, copy=True)

unpack f,args,kwargs from buffers packed by pack_apply_message() Returns: original f,args,kwargs