[PySide] Starting with shiboken

421 views
Skip to first unread message

Francisco García

unread,
Mar 26, 2012, 2:18:43 PM3/26/12
to pys...@lists.pyside.org
Hello, I am trying to collect as many examples as possible binding C++ libraries with Python (cython, ctypes, bost, switg...)

First I am trying to do a type of "hello world" for binding. Something like binding this C++ library

int add_these_numbers(int a, int b);

however doing that with Shiboken and following the tutorial is not as piece of cake as the others. There are so many steps and files, that it can be overwhelming when compared with the others. I am even trying to avoid CMake, just to get a clear picture of what is going on. I have the feeling that Shiboken is not really hard. Just a lack of more blogs talking about it and more documentation. Also I could I could not find the sources of the tutorial. At least it is not in the shiboken repo.

where could I download those sources?

I also saw on the PySide website a comment about the size of the binaries generated by Boost compared against the size generated by Shiboken. It was a good post with a more detailed explanation about the reasons for droping Boost. Does anyone have the link?

Can Shiboken map as much of C++ as Boost? (polymorphism, operator/function overloading...)

thanks in advance for all the possible help!

Francisco
_______________________________________________
PySide mailing list
PyS...@qt-project.org
http://lists.qt-project.org/mailman/listinfo/pyside

Hugo Parente Lima

unread,
Mar 26, 2012, 2:48:52 PM3/26/12
to pys...@qt-project.org, pys...@lists.pyside.org
On Monday 26 March 2012 15:18:43 Francisco García wrote:
> Hello, I am trying to collect as many examples as possible binding C++
> libraries with Python (cython, ctypes, bost, switg...)

A good read about bindings:

http://setantas.net/pages/bindingcpp.html



> First I am trying to do a type of "hello world" for binding. Something like
> binding this C++ library
>
> int add_these_numbers(int a, int b);
>
> however doing that with Shiboken and following the tutorial is not as piece
> of cake as the others. There are so many steps and files, that it can be
> overwhelming when compared with the others. I am even trying to avoid
> CMake, just to get a clear picture of what is going on. I have the feeling
> that Shiboken is not really hard. Just a lack of more blogs talking about
> it and more documentation. Also I could I could not find the sources of
> the tutorial. At least it is not in the shiboken repo.

Shiboken isn't too easy to start and the lack of documentation just makes the
bootstraping harder, so any initiative to create documentation and/or
tutorials are welcome.



> where could I download those sources?

From the tutorial? Which tutorial?



> I also saw on the PySide website a comment about the size of the binaries
> generated by Boost compared against the size generated by Shiboken. It was
> a good post with a more detailed explanation about the reasons for droping
> Boost. Does anyone have the link?

This must be a really old post, because we dropped boost::python more than a
year ago, maybe two.



> Can Shiboken map as much of C++ as Boost? (polymorphism, operator/function
> overloading...)

Yes it can :-).



> thanks in advance for all the possible help!
>
> Francisco
> _______________________________________________
> PySide mailing list
> PyS...@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

--
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia

signature.asc

Francisco García

unread,
Mar 27, 2012, 1:54:57 AM3/27/12
to Hugo Parente Lima, pys...@qt-project.org, pys...@lists.pyside.org

Am 26.03.2012 um 20:48 schrieb Hugo Parente Lima:

> On Monday 26 March 2012 15:18:43 Francisco García wrote:
>> Hello, I am trying to collect as many examples as possible binding C++
>> libraries with Python (cython, ctypes, bost, switg...)
>
> A good read about bindings:
>
> http://setantas.net/pages/bindingcpp.html
>

OMG! That was complete bindings porno. It really covers the tiny details. I love it!

but still, must face the hello world type of problem with Shiboken :(


>> First I am trying to do a type of "hello world" for binding. Something like
>> binding this C++ library
>>
>> int add_these_numbers(int a, int b);
>>
>> however doing that with Shiboken and following the tutorial is not as piece
>> of cake as the others. There are so many steps and files, that it can be
>> overwhelming when compared with the others. I am even trying to avoid
>> CMake, just to get a clear picture of what is going on. I have the feeling
>> that Shiboken is not really hard. Just a lack of more blogs talking about
>> it and more documentation. Also I could I could not find the sources of
>> the tutorial. At least it is not in the shiboken repo.
>
> Shiboken isn't too easy to start and the lack of documentation just makes the
> bootstraping harder, so any initiative to create documentation and/or
> tutorials are welcome.

Well, I am for it !

>
>> where could I download those sources?
>
> From the tutorial? Which tutorial?

I meant this:
http://qt-project.org/wiki/Category:LanguageBindings::PySide::Shiboken::PySide_Binding_Generation_Tutorial

Although the subcategories are confusing:
http://qt-project.org/wiki/Category:LanguageBindings::PySide::Shiboken

I could not find the sources of the example within the shiboken repository. Copy/Paste is painful because the numbers cannot be disable.

I am trying to start with a much simpler case and a simple Makefile where I could clearly see the build steps

>
>> I also saw on the PySide website a comment about the size of the binaries
>> generated by Boost compared against the size generated by Shiboken. It was
>> a good post with a more detailed explanation about the reasons for droping
>> Boost. Does anyone have the link?
>
> This must be a really old post, because we dropped boost::python more than a
> year ago, maybe two.

I know it was dropped some years ago. But someone of the team wrote a good post about the reasons and giving real numbers. Like the exact difference of size in the generated binaries. I know boost generates bigger binaries, but it was great having a real case story with real numbers. Sadly I cannot find that now

is this still the right place to ask about shiboken?
is the source code of the tutorial available?
is there an intro more "shiboken for dummies" like me?
is it too hard just dropping CMake and doing all the steps by hand?

anatoly techtonik

unread,
Mar 27, 2012, 3:29:07 AM3/27/12
to Hugo Parente Lima, pys...@qt-project.org, pys...@lists.pyside.org
On Mon, Mar 26, 2012 at 9:48 PM, Hugo Parente Lima
<hugo...@openbossa.org> wrote:
> On Monday 26 March 2012 15:18:43 Francisco García wrote:
>> Hello, I am trying to collect as many examples as possible binding C++
>> libraries with Python (cython, ctypes, bost, switg...)
>
> A good read about bindings:
>
> http://setantas.net/pages/bindingcpp.html
>
>> First I am trying to do a type of "hello world" for binding. Something like
>> binding this C++ library
>>
>>     int add_these_numbers(int a, int b);
>>
>> however doing that with Shiboken and following the tutorial is not as piece
>> of cake as the others. There are so many steps and files, that it can be
>> overwhelming when compared with the others. I am even trying to avoid
>> CMake, just to get a clear picture of what is going on. I have the feeling
>> that Shiboken is not really hard. Just a lack of more blogs talking about
>> it and more documentation. Also I could I could not find the sources of
>> the tutorial. At least it is not in the shiboken repo.
>
> Shiboken isn't too easy to start and the lack of documentation just makes the
> bootstraping harder, so any initiative to create documentation and/or
> tutorials are welcome.

I was interested to try Shiboken to recreate AVbin - simple Python
binding for FFmpeg - http://avbin.github.com/AVbin/Home/Home.html So
I've started a tutorial a while ago, but run out of free time to
complete it. Feel free to fork and update. It should be a good
starting point. And the Mercurial history illustrates the steps I took
with problems encountered.

https://bitbucket.org/techtonik/shiboken-avbin/overview

Seems like typesystem.xml syntax and rules was the major showstopper
at that time.
--
anatoly t.

Reply all
Reply to author
Forward
0 new messages