[zeromq-dev] zproto python support?

Joe McIlvain joe.eli.mac at gmail.com
Fri Apr 24 04:34:13 CEST 2015


Michel,

Much of the work for what you're talking about is already done by others in
zproject (see
https://github.com/zeromq/zproject/blob/master/zproject_bindings_python.gsl).
The zproject code generators do two major things:

1) generate the build systems and project skeleton for a C library.
2) generate bindings for those C libraries in multiple languages, including
ruby and python.

I did much of the ruby work for this system, and don't know much about how
the python bindings work, but I do know they use ctypes.  I also know that
much of czmq is already modelled to be wrapped in this way.  Please take a
look at the XML models in https://github.com/zeromq/czmq/tree/master/api -
every model there is used to generate a corresponding binding in the python
bindings (see
https://github.com/zeromq/czmq/blob/master/bindings/python/czmq.py)  I
don't see a model for zgossip, but that's only because no one has needed it
yet - it could be easily added as the models are quick to write once you
understand the key terms to use.  Give it a try and if you need help, ask
us for help.

Arnaud,

This answer is probably not helpful for you if you are actually trying to
port to pure python, but you might take a look at what I linked to anyway
to get some examples of GSL generating python code and combine that
understanding with what you can learn from the other language ports of
zproto.

Good luck on a python port of zproto - I think it would be great to bring
the vibrant python zmq community in on the zproto fun. :)

On Thu, Apr 23, 2015 at 9:14 AM, Michel Pelletier <
pelletier.michel at gmail.com> wrote:

> Generating pyzmq is one approach, another to consider is generating a
> python C wrapper around the zproto C generation with ctypes or cffi.  That
> way it just becomes a thin layer on top of an already proven one.  I've
> briefly looked at the latter but haven't had time to spike the idea out any
> further.
>
> -Michel
>
> On Thu, Apr 23, 2015 at 4:52 AM, Pieter Hintjens <ph at imatix.com> wrote:
>
>> Start with the zproto_codec layer, take any of the existing
>> generators, and copy/rename with a _py in the filename. Build/install
>> imatix/gsl. Take zproto_example.xml and generate using:
>>
>>     gsl -script:zproto_codec_py zproto_example
>>
>> On Thu, Apr 23, 2015 at 1:08 PM, Arnaud Loonstra <arnaud at sphaero.org>
>> wrote:
>> > Hi all,
>> >
>> > I'm currently working on porting zgossip to Python but running into
>> > wrapping my head around zproto which is used to generate the code. Has
>> > there been any attempt for generating python code using zproto? I see
>> > there's go, php and csharp support? Any pointers to what it would mean
>> > to add Python support?
>> >
>> > Rg,
>> >
>> > Arnaud
>> > _______________________________________________
>> > zeromq-dev mailing list
>> > zeromq-dev at lists.zeromq.org
>> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150423/cbfed715/attachment.htm>


More information about the zeromq-dev mailing list