This is a coarse summary of changes in pyzmq versions. For a real changelog, consult the git log
This is a tech-preview release, to try out some new features. It is expected to be short-lived, as there are likely to be issues to iron out, particularly with the new pip-install support.
These features are marked ‘experimental’, which means that their APIs are not set in stone, and may be removed or changed in incompatible ways in later releases.
With the IOLoop inherited from tornado, there is exactly one method that is threadsafe: IOLoop.add_callback(). With this release, we are trying an experimental option to pass all IOLoop calls via this method, so that ZMQStreams can be used from one thread while the IOLoop runs in another. To try out a threadsafe stream:
stream = ZMQStream(socket, threadsafe=True)
PyZMQ should now be pip installable, even on systems without libzmq. In these cases, when pyzmq fails to find an appropriate libzmq to link against, it will try to build libzmq as a Python extension. This work is derived from pyzmq_static.
To this end, PyZMQ source distributions include the sources for libzmq (2.2.0) and libuuid (2.21), both used under the LGPL.
The excellent gevent_zeromq socket subclass which provides gevent compatibility has been merged as zmq.green.
See also
Some effort has gone into refining the pyzmq API in this release to make it a model for other language bindings. This is principally made in a few renames of objects and methods, all of which leave the old name for backwards compatibility.
Note
As of this release, all code outside zmq.core is BSD licensed (where possible), to allow more permissive use of less-critical code and utilities.
These features are marked ‘experimental’, which means that their APIs are not set in stone, and may be removed or changed in incompatible ways in later releases.
remove support for LABEL prefixes. A major feature of libzmq-3.0, the LABEL prefix, has been removed from libzmq, prior to the first stable libzmq 3.x release.
add Socket.poll() method, for simple polling of events on a single socket.
no longer require monkeypatching tornado IOLoop. The ioloop.ZMQPoller class is a poller implementation that matches tornado’s expectations, and pyzmq sockets can be used with any tornado application just by specifying the use of this poller. The pyzmq IOLoop implementation now only trivially differs from tornado’s.
It is still recommended to use ioloop.install(), which sets both the zmq and tornado global IOLoop instances to the same object, but it is no longer necessary.
Warning
The most important part of this change is that the IOLoop.READ/WRITE/ERROR constants now match tornado’s, rather than being mapped directly to the zmq POLLIN/OUT/ERR. So applications that used the low-level IOLoop.add_handler() code with POLLIN/OUT/ERR directly (used to work, but was incorrect), rather than using the IOLoop class constants will no longer work. Fixing these to use the IOLoop constants should be insensitive to the actual value of the constants.
Add support for libzmq-3.0 LABEL prefixes:
Warning
This feature has been removed from libzmq, and thus removed from future pyzmq as well.
send a message with label-prefix with:
send_multipart([b'msg', b'parts'], prefix=[b'label', b'prefix'])
recv_multipart() returns a tuple of (prefix,msg) if a label prefix is detected
ZMQStreams and devices also respect the LABEL prefix
add czmq-style close&term as ctx.destroy(), so that ctx.term() remains threadsafe and 1:1 with libzmq.
Socket.close() takes optional linger option, for setting linger prior to closing.
add zmq_version_info() and pyzmq_version_info() for getting libzmq and pyzmq versions as tuples of numbers. This helps with the fact that version string comparison breaks down once versions get into double-digits.
ioloop changes merged from upstream Tornado 2.1
s.hwm = 10
s.identity = b'whoda'
s.linger
# -1