[zeromq-dev] malamute python2 bindings -- advice needed

Aaron Sokoloski asokoloski at gmail.com
Mon Jan 25 15:47:50 CET 2016


Hi folks,

I'm trying to create a small python binding for malamute, by writing a
wrapper around the auto-generated zproject binding for python2.  I've got
it partly working, but I've gotten stuck and could use some advice, in the
hope of saving time pursuing a dead-end.

My problim is trying to convert the zmsg_t* returned by mlm_client_recv to
something python code can deal with, ideally, just a list of strings.

Using libczmq in C this is quite simple.  So I thought that from python, I
could either A) use the czmq bindings auto-generated by zproject or B) use
pyczmq.

However, for each of these approaches I ran into problems that I'm not sure
how to fix.

A) czmq.py doesn't seem to get installed, and seems broken at the moment
too.  Should it be installed along with libczmq?  Maybe nobody is using
it.  I could try to fix it up, but even then, does it make sense to have
this exist alongside pyczmq?

B) pyczmq uses CFFI, while zproject generates Ctypes bindings.  I've tried
to get these to work together, and have encountered a lot of pain and not
much success so far.

I thought about trying to modify zproject_python.gsl to generate partial
bindings for dependencies of a class, but this just seems a bit wrongheaded.

I could add another method to mlm_client JUST to support the python
bindings, but this also seems ugly, and grows more ugly if there are other
methods added that deal with czmq objects.

Maybe the right thing to do is to change zproject to also generate a CFFI
version of the python bindings.  Then the malamute CFFI bindings could
interact with pyczmq easily.  However, this is a bit more work so I wanted
to get people's thoughts first.

Cheers,
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160125/0ea7ddbd/attachment.htm>


More information about the zeromq-dev mailing list