[zeromq-dev] CZMQ Python Bindings
Michel Pelletier
pelletier.michel at gmail.com
Fri Oct 11 18:11:08 CEST 2013
There is a very minimal INSTALL.md in the repo, but basically you just need
to install czmq (and zmq obviously) and on ubuntu the libffi-dev package.
After that run '. bootstrap' which will create a python virtual
environment for you and install the dependency (which is the python cffi
package). After that "python -c 'import pyczmq'" should succeed.
Alternatively if you don't care about the VE and don't mind installing it
into your system Python instead of running the bootstrap you can do 'sudo
python setup.py install'
-Michel
On Fri, Oct 11, 2013 at 8:57 AM, Pieter Hintjens <ph at imatix.com> wrote:
> Michel,
>
> It would be useful (to me at least) to have a brief list of what I
> need to install in order to build this (Ubuntu).
>
> -Pieter
>
> On Fri, Oct 11, 2013 at 5:40 PM, Michel Pelletier
> <pelletier.michel at gmail.com> wrote:
> > Thanks Felipe! I appreciate the kind words and I hope you enjoy your
> > vacation. I'm really enjoying the cffi module, it seems like one of
> those
> > cool projects that creates a convergence in the evolution of software.
> >
> > For those who are interested I've made some more progress:
> >
> > There's an initial start at wrapping the low level zmq functions in
> > pyczmq.zmq. This was done largely to expose the ability to do "zero
> copy"
> > messages support for which was removed from czmq.
> >
> > New code format permits automatic sphinx documentation, which is now
> hosted
> > via an automatic git commit hook thanks to readthedocs.org, for example:
> >
> http://pyczmq.readthedocs.org/en/latest/pyczmq.html#module-pyczmq.zsocket
> >
> > I'm going to try and get all the loose ends wrapped up this week and
> drop a
> > lot more tests in.
> >
> > -Michel
> >
> >
> >
> >
> > On Thu, Oct 10, 2013 at 3:42 PM, Felipe Cruz <felipecruz at loogica.net>
> wrote:
> >>
> >> Hi Michael.
> >>
> >> Unfortunately there's no such tool for python cffi. Even pyzmq is a mix
> of
> >> cython and cffi, both manually coded.
> >>
> >> Anyway, I'm very interested in provide access for features like zbeacon
> >> and projects like FileMQ to high level languages such as Python. There
> are a
> >> lot of opportunities to be explored when those features become
> available.
> >>
> >> I'm on vacation right now but ASAP, I would like to participate in make
> >> this moving forward!
> >>
> >> great work BTW
> >>
> >> regards,
> >> Felipe
> >>
> >>
> >>
> >>
> >>
> >> 2013/10/9 Pieter Hintjens <ph at imatix.com>
> >>>
> >>> I've never heard of such a tool but it seems worth making... I'll have
> >>> a whack at it when I get bored later this week.
> >>>
> >>> On Wed, Oct 9, 2013 at 9:24 PM, Michel Pelletier
> >>> <pelletier.michel at gmail.com> wrote:
> >>> > Automation would be be great, and not just for Python, making the
> >>> > wrapper
> >>> > was a bit tedious, although completely doable. I'm surprised there
> >>> > isn't
> >>> > something like SWIG but for libffi, where you can point a .h file and
> >>> > some
> >>> > kind of specfile at a tool that dumps the correct bindings
> incantation
> >>> > for
> >>> > various languages. Maybe there is such a tool? A quick google
> didn't
> >>> > reveal much to me.
> >>> >
> >>> > -Michel
> >>> >
> >>> >
> >>> > On Wed, Oct 9, 2013 at 12:27 AM, Pieter Hintjens <ph at imatix.com>
> wrote:
> >>> >>
> >>> >> Hi Michel,
> >>> >>
> >>> >> This is great fun! I'm going to look at what you did since I'd like
> to
> >>> >> try generating Python wrappers for our standardish C APIs (FileMQ,
> >>> >> Zyre, for instance).
> >>> >>
> >>> >> -Pieter
> >>> >>
> >>> >> On Wed, Oct 9, 2013 at 4:28 AM, Michel Pelletier
> >>> >> <pelletier.michel at gmail.com> wrote:
> >>> >> > Wanting to know more about Python and CFFI, I decided to do a
> >>> >> > straightforward wrap job for Python around the CZMQ C API. I have
> >>> >> > it
> >>> >> > reasonable complete enough to write some simple code and tests.
> >>> >> > I've
> >>> >> > pushed
> >>> >> > it up to github:
> >>> >> >
> >>> >> > https://github.com/michelp/pyczmq
> >>> >> >
> >>> >> > Most of the core functionality, zctx, zsocket, zsockopt, zpoller,
> >>> >> > zmsg,
> >>> >> > zframe, zstr, zloop, zbeacon, zcert, zauth, are exposed as both
> >>> >> > straight
> >>> >> > wrappers around the C interface as well as some namespaced
> functions
> >>> >> > that
> >>> >> > provide a high level functional interface (eg, turning cdata char
> *
> >>> >> > into
> >>> >> > python byte strings, etc). For example:
> >>> >> >
> >>> >> >
> >>> >> > ctx = zctx.new()
> >>> >> > push = zsocket.new(ctx, zsocket.PUSH)
> >>> >> > pull = zsocket.new(ctx, zsocket.PULL)
> >>> >> > zsocket.bind(push, 'inproc://test')
> >>> >> > zsocket.connect(pull, 'inproc://test')
> >>> >> > zstr.send(push, 'foo')
> >>> >> > assert zstr.recv(pull) == 'foo'
> >>> >> > zstr.send(push, 'bar')
> >>> >> > zsocket.poll(pull, 1)
> >>> >> > assert zstr.recv_nowait(pull) == 'bar'
> >>> >> >
> >>> >> >
> >>> >> >
> >>> >> > There's also a first stab at providing an OO interface in the form
> >>> >> > of
> >>> >> > Context, Socket, Beacon and Loop classes. Here's a working
> example:
> >>> >> >
> >>> >> > ctx = Context()
> >>> >> > pub = ctx.socket('PUB')
> >>> >> > sub = ctx.socket('SUB')
> >>> >> > sub.set_subscribe('')
> >>> >> > pub.bind('inproc://zoop')
> >>> >> > sub.connect('inproc://zoop')
> >>> >> > pub.send('foo')
> >>> >> > sub.poll(1)
> >>> >> > assert sub.recv() == 'foo'
> >>> >> >
> >>> >> >
> >>> >> > This is a work in progress, it's useful enough now to create
> socket
> >>> >> > and
> >>> >> > messages and send and receive data. I'd certainly love any form
> of
> >>> >> > help,
> >>> >> > just send me a pull request. Featured desired are way more tests!
> >>> >> > And
> >>> >> > of
> >>> >> > course any missing functions that need wrapping, or new
> >>> >> > functionality.
> >>> >> >
> >>> >> > Thanks and enjoy,
> >>> >> >
> >>> >> > -Michel
> >>> >> >
> >>> >> > _______________________________________________
> >>> >> > 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
> >>> >
> >>> _______________________________________________
> >>> zeromq-dev mailing list
> >>> zeromq-dev at lists.zeromq.org
> >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >>
> >>
> >>
> >>
> >> --
> >> Felipe Cruz
> >> http://about.me/felipecruz
> >>
> >> _______________________________________________
> >> 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/20131011/c3347241/attachment.htm>
More information about the zeromq-dev
mailing list