[zeromq-dev] New Python bindings

Martin Sustrik sustrik at 250bpm.com
Mon Feb 15 10:23:09 CET 2010


Hi,

> Over the last day I have redone the Python bindings from scratch.  The
> overall design is the same, but I have used Cython, which will make
> the bindings easier to develop/maintain and more flexible in the long
> run.  Here is my github repo for this:
> 
> http://github.com/ellisonbg/pyzmq
> 
> Some highlights of what I have done so far:
> 
> * Cython (http://www.cython.org) based.  Cython is not a requirement
> for using this, only
> for developers.
> * Improved performance.  For small msg sizes, the performance is the
> same as the previous Python bindings, but for larger message sizes,
> the latency and throughput
> benchmarks are better.  The main improvement is that on sends I am not
> doing a memcpy
> to copy the Python string to the msg struct.  The msg struct simply
> uses the same buffer
> that the Python str object is using.
> * Better error handling.
> * A build system (setup.py) that is standalone and a bit more configurable.
> * New send_json/revc_json and send_pyobj/recv_pyobj methods of Socket that
> allow you to send Python objects as messages using Python's pickle
> serialization or json.
> 
> The only part of the API that I have not wrapped is zmq_poll.  This is
> next on my list.  But first, I want to understand the design of
> zmq_poll a bit better.  I have started a thread to discuss those
> things.
> 
> I have licensed this code as LGLP and am fine with it being pulled
> into the main zeromq repo if that is wanted.

Great! The binding looks much better than the existing one, so once the 
problem with sent message deallocation is fixed and the binding is 
tested (does it work on Win32?) I would kill the existing Python binding 
in the core repo.

What we are trying to do is to remove the bindings from the main repo. 
There are many reasons for doing so, mainly because individual languages 
tend to use different build systems, different documentation formats 
etc. which makes single package a mess.

Thus we can use your repository as a source for Python binding, if you 
have no objections. If so, please register on the website (upper right 
corner of the page) and I'll give you write access so that you can 
modify the Python binding page accordingly.

Martin



More information about the zeromq-dev mailing list