You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Volker Diels-Grabsch <v...@njh.eu> on 2016/09/01 08:29:22 UTC
Re: Python support for AMQP 1.0?
Gordon Sim schrieb:
> On 31/08/16 18:26, Volker Diels-Grabsch wrote:
> > In other words, how is a Python program meant to communicate with an
> > AMQP 1.0 server?
[...]
> Use the proton library for python. There is an overview, a tutorial, some
> examples and an API reference of sorts:
> https://qpid.apache.org/proton/index.html. Feel free also to ask questions
> on this list.
Thanks for the quick reply!
So I have to switch from a pure-Python implementation to a C library
with Python wrapper. This is inconvenient for deployment, but not a
show stopper for me.
I compiled qpid-proton on my own, where some questions arose:
1) Is it possible to build just the Python part? (plus C library, of course)
2) If not, is there at least a way to build just proton-c without proton-j?
3) Is it possible to link the _cproton.so wrapper and the libqpid-proton.so
library into a single *.so file?
(Rather than having _cproton.so depending on libqpid-proton.so
which has to be installed system wide or needs LD_LIBRARY_PATH
magic.)
Regards,
Volker
--
Volker Diels-Grabsch
----<<<((()))>>>----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Python support for AMQP 1.0?
Posted by Ken Giusti <kg...@redhat.com>.
Hi Volker,
I would recommend you use the python-qpid-proton package available at the pypi repository:
https://pypi.python.org/pypi/python-qpid-proton/0.14.0
The package setup script will automagically check to see if the proton-c library has been installed and will use it if available. Otherwise the setup script will pull down the necessary C files from apache.org and build and install them to your site-packages dir.
This will avoid downloading the whole proton distribution and building everything - only the C stuff necessary for the python binding is built.
Having said that - you'll need to have the proper build tools and libraries installed in order for this build to succeed. At a minimum you'll need SWIG, the python development libraries installed and the dev packages for whatever libs you need for proton-c (like OpenSSL or Cyrus SASL)
One caveat: this build script only works on linux-based systems. It should work on other unix-y systems but hasn't seen much testing there. And windows is a no-go at this point. Of course, patches to support other platforms would be gladly accepted :)
-K
----- Original Message -----
> From: "Volker Diels-Grabsch" <v...@njh.eu>
> To: users@qpid.apache.org
> Sent: Thursday, September 1, 2016 4:29:22 AM
> Subject: Re: Python support for AMQP 1.0?
>
> Gordon Sim schrieb:
> > On 31/08/16 18:26, Volker Diels-Grabsch wrote:
> > > In other words, how is a Python program meant to communicate with an
> > > AMQP 1.0 server?
> [...]
> > Use the proton library for python. There is an overview, a tutorial, some
> > examples and an API reference of sorts:
> > https://qpid.apache.org/proton/index.html. Feel free also to ask questions
> > on this list.
>
> Thanks for the quick reply!
>
> So I have to switch from a pure-Python implementation to a C library
> with Python wrapper. This is inconvenient for deployment, but not a
> show stopper for me.
>
> I compiled qpid-proton on my own, where some questions arose:
>
> 1) Is it possible to build just the Python part? (plus C library, of course)
>
> 2) If not, is there at least a way to build just proton-c without proton-j?
>
> 3) Is it possible to link the _cproton.so wrapper and the libqpid-proton.so
> library into a single *.so file?
>
> (Rather than having _cproton.so depending on libqpid-proton.so
> which has to be installed system wide or needs LD_LIBRARY_PATH
> magic.)
>
>
> Regards,
> Volker
>
> --
> Volker Diels-Grabsch
> ----<<<((()))>>>----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>
--
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Python support for AMQP 1.0?
Posted by Ken Giusti <kg...@redhat.com>.
My bad - we've never exactly publicized that behavior.
:)
----- Original Message -----
> From: "Gordon Sim" <gs...@redhat.com>
> To: users@qpid.apache.org
> Sent: Thursday, September 1, 2016 9:09:36 AM
> Subject: Re: Python support for AMQP 1.0?
>
> On 01/09/16 13:44, Ken Giusti wrote:
> >
> >
> > ----- Original Message -----
> >> From: "Gordon Sim" <gs...@redhat.com>
> >> To: users@qpid.apache.org
> >> Sent: Thursday, September 1, 2016 8:32:15 AM
> >> Subject: Re: Python support for AMQP 1.0?
> >>
> >> On 01/09/16 09:29, Volker Diels-Grabsch wrote:
> >>> So I have to switch from a pure-Python implementation to a C library
> >>> with Python wrapper. This is inconvenient for deployment, but not a
> >>> show stopper for me.
> >>>
> >>> I compiled qpid-proton on my own, where some questions arose:
> >>>
> >>> 1) Is it possible to build just the Python part? (plus C library, of
> >>> course)
> >>
> >> Yes, you can turn off other languages with cmake options
> >> (-DBUILD_CPP=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVA=OFF
> >> -DBUILD_GO=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_PHP=OFF)
> >>
> >> You can see all the options with ccmake, and edit them interactively.
> >>
> >>> 2) If not, is there at least a way to build just proton-c without
> >>> proton-j?
> >>>
> >>> 3) Is it possible to link the _cproton.so wrapper and the
> >>> libqpid-proton.so
> >>> library into a single *.so file?
> >>
> >> No, I don't believe it is.
> >>
> >>
> >
> > Actually, this is exactly what the Pypi setup package script does if the
> > python libs are not installed.
>
> Oops! I apologise for the misinformation!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>
--
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Python support for AMQP 1.0?
Posted by Gordon Sim <gs...@redhat.com>.
On 01/09/16 13:44, Ken Giusti wrote:
>
>
> ----- Original Message -----
>> From: "Gordon Sim" <gs...@redhat.com>
>> To: users@qpid.apache.org
>> Sent: Thursday, September 1, 2016 8:32:15 AM
>> Subject: Re: Python support for AMQP 1.0?
>>
>> On 01/09/16 09:29, Volker Diels-Grabsch wrote:
>>> So I have to switch from a pure-Python implementation to a C library
>>> with Python wrapper. This is inconvenient for deployment, but not a
>>> show stopper for me.
>>>
>>> I compiled qpid-proton on my own, where some questions arose:
>>>
>>> 1) Is it possible to build just the Python part? (plus C library, of
>>> course)
>>
>> Yes, you can turn off other languages with cmake options
>> (-DBUILD_CPP=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVA=OFF
>> -DBUILD_GO=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_PHP=OFF)
>>
>> You can see all the options with ccmake, and edit them interactively.
>>
>>> 2) If not, is there at least a way to build just proton-c without proton-j?
>>>
>>> 3) Is it possible to link the _cproton.so wrapper and the libqpid-proton.so
>>> library into a single *.so file?
>>
>> No, I don't believe it is.
>>
>>
>
> Actually, this is exactly what the Pypi setup package script does if the python libs are not installed.
Oops! I apologise for the misinformation!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Python binding without libqpid-proton dependency
Posted by Andrew Stitcher <as...@redhat.com>.
On Sat, 2016-09-03 at 09:26 +0200, Volker Diels-Grabsch wrote:
> Hi Gordon, Ken,
>
> Thanks for your useful explainations.��Neither of them solved my
> problem fully, but the combination did. :-)
Here is a relatively simple procedure for building a python package
like you describe from the source distribution (or a source repo)
I assume you have the source tree already; and you don't have the
libqpid-proton.so installed anywhere accessible.
$ cd proton-c/bindings/python/
$ python setup.py bdist_dumb
This will build a tar archive in dist for the 0.14.0 release on Linux
x86_64 it is called python-qpid-proton-0.14.0.linux-x86_64.tar.gz .
You can unpack that tgz in the correct place.
If you have a virtualenv setup it is even easier just to run
$ python setup.py install
And this will install the qpid-protob python binding directly in the
virtualenv you've setup where it can be found with pip.
Hope that simplifies things for you.
Andrew
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Python binding without libqpid-proton dependency
Posted by Volker Diels-Grabsch <v...@njh.eu>.
Hi Gordon, Ken,
Thanks for your useful explainations. Neither of them solved my
problem fully, but the combination did. :-)
To document this for future readers, this is what I did, which is
different from the approach taken by the PIP package, but allows
for offline-building just from the pristine qpid-proton source.
I decided to reuse as much of the original build process as possible.
So I disabled everything except for the Python bindings and built
qpid-proton normally:
cmake \
-DBUILD_CPP=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVA=OFF \
-DBUILD_GO=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_PHP=OFF
make -j 4
Now, all I needed to do was to assemble the second last build results,
that is, all *.o files of Proton-C and Proton-Python. Listing them
was fairly straight forward:
find \
proton-c/CMakeFiles/qpid-proton.dir \
proton-c/bindings/python/CMakeFiles/_cproton.dir \
-name '*.o'
Using this as a sub command, I linked them together into a single *.so
file, taking care of the OpenSSL dependency:
gcc \
-shared \
$(find \
proton-c/CMakeFiles/qpid-proton.dir \
proton-c/bindings/python/CMakeFiles/_cproton.dir \
-name '*.o') \
$(pkg-config openssl --libs) \
-o _cproton.so
Interestingly, the resulting *.so had very few dependencies in total,
but it worked! I did not even need link to "libpython2.7.so.*".
$ ldd _cproton.so
linux-vdso.so.1 (0x00007ffe98189000)
libssl.so.1.0.2 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2 (0x00007f37510b2000)
libcrypto.so.1.0.2 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2 (0x00007f3750c4f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f37508ad000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f37506a9000)
/lib64/ld-linux-x86-64.so.2 (0x000055b75c64f000)
Finally, I stripped debug symbols and similar from _cproton.so to
reduce its size, which was not necessary but a matter of taste:
strip -s _cproton.so
Afterwards, I needed to install just the following files:
_cproton.so
proton-c/bindings/python/cproton.py
proton-c/bindings/python/proton/*.py
Regards,
Volker
--
Volker Diels-Grabsch
----<<<((()))>>>----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Python support for AMQP 1.0?
Posted by Ken Giusti <kg...@redhat.com>.
----- Original Message -----
> From: "Gordon Sim" <gs...@redhat.com>
> To: users@qpid.apache.org
> Sent: Thursday, September 1, 2016 8:32:15 AM
> Subject: Re: Python support for AMQP 1.0?
>
> On 01/09/16 09:29, Volker Diels-Grabsch wrote:
> > So I have to switch from a pure-Python implementation to a C library
> > with Python wrapper. This is inconvenient for deployment, but not a
> > show stopper for me.
> >
> > I compiled qpid-proton on my own, where some questions arose:
> >
> > 1) Is it possible to build just the Python part? (plus C library, of
> > course)
>
> Yes, you can turn off other languages with cmake options
> (-DBUILD_CPP=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVA=OFF
> -DBUILD_GO=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_PHP=OFF)
>
> You can see all the options with ccmake, and edit them interactively.
>
> > 2) If not, is there at least a way to build just proton-c without proton-j?
> >
> > 3) Is it possible to link the _cproton.so wrapper and the libqpid-proton.so
> > library into a single *.so file?
>
> No, I don't believe it is.
>
>
Actually, this is exactly what the Pypi setup package script does if the python libs are not installed. The resultant _cproton.so contains all the proton-c bits necessary, there are no external deps on libqpid-proton.so:
[kgiusti@localhost site-packages (master)]$ ls -l *cproton*
-rw-rw-r--. 1 kgiusti kgiusti 117534 Aug 30 08:53 cproton.py
-rw-rw-r--. 1 kgiusti kgiusti 196120 Aug 30 08:53 cproton.pyc
-rwxrwxr-x. 1 kgiusti kgiusti 2917992 Aug 30 08:53 _cproton.so
[kgiusti@localhost site-packages (master)]$ ldd _cproton.so
linux-vdso.so.1 (0x00007ffe01df2000)
libssl.so.10 => /lib64/libssl.so.10 (0x00007f30a6052000)
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f30a5bf2000)
libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007f30a59d4000)
libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007f30a5605000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f30a53e7000)
libc.so.6 => /lib64/libc.so.6 (0x00007f30a5025000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f30a4dd7000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f30a4aef000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f30a48ea000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f30a46b8000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f30a44b4000)
libz.so.1 => /lib64/libz.so.1 (0x00007f30a429d000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f30a4082000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f30a3e4c000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f30a3c48000)
libm.so.6 => /lib64/libm.so.6 (0x00007f30a3946000)
/lib64/ld-linux-x86-64.so.2 (0x0000562d14006000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f30a3737000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f30a3532000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007f30a332f000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f30a310b000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f30a2e98000)
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>
--
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Python support for AMQP 1.0?
Posted by Gordon Sim <gs...@redhat.com>.
On 01/09/16 09:29, Volker Diels-Grabsch wrote:
> So I have to switch from a pure-Python implementation to a C library
> with Python wrapper. This is inconvenient for deployment, but not a
> show stopper for me.
>
> I compiled qpid-proton on my own, where some questions arose:
>
> 1) Is it possible to build just the Python part? (plus C library, of course)
Yes, you can turn off other languages with cmake options
(-DBUILD_CPP=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVA=OFF
-DBUILD_GO=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_PHP=OFF)
You can see all the options with ccmake, and edit them interactively.
> 2) If not, is there at least a way to build just proton-c without proton-j?
>
> 3) Is it possible to link the _cproton.so wrapper and the libqpid-proton.so
> library into a single *.so file?
No, I don't believe it is.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org