of 36 /36
PySide Python Bindings for the Qt Framework Marcelo Lira - setanta March, 10th / Manaus - AM

Embed Size (px)


Python bindings for the Qt Framework.

Transcript of PySide

  • 1.PySide Python Bindings for the Qt Framework Marcelo Lira - setanta March, 10th / Manaus - AM

2. Prologue 3. Who Am I? Paid Open Source developer (lucky me!) Computer Engineering Undergrad I like Python but code mostly in C++(its the "binding developer paradox") PySide / PyMaemo team member at INdT 4. Who We Are? INdT - Instituto Nokia de Tecnologia openBossa - INdTs open source stream Known projects: Canola, Carman, PyMaemo Friends of Qt Development Frameworks / KDE 5. Qt Labs Americas openBossa initiative Development of Qt and KDE communities on theAmericas 6. Python "Python is the best language ever invented!" -- me import antigravity 7. Qt Frameworks Cross-platform application development framework.A little while after Nokias acquisition of Trolltech Qt started being distributed under the LGPL license. 8. Todays Topics PySide Binding Generation Current Status Future 9. PySide == Python + QtPySide is how we call the Python bindings of the QtFramework produced by INdT/openBossa/Qt LabsAmericas and released under the LGPL license. 10. PySide MotivationPython bindings for Qt under the LGPL license, aligned with the new licensing of Qt. Make the Qt-Python bindings fithand-in-glove on the Maemo platformand devices.Because we are the INdT. 11. PySide Overview PySide: the thing that you import libpyside: takes care of Qt signals/slots libshiboken: helps interfacing Python with C++ 12. Binding Assembly Line Qt Headers: the basic information about Qt libraries comes from here. Type System files: here the binding developer modifies the collected information to fit the Python language. Handwritten code: code to handle the C++ idiosyncrasies that could appear. 13. And Why Not...? Cython ctypes Swig SIP SMOKE Boost.Python My favorite technology... 14. Binding Generation 15. PySide Goals Besides delivering LGPL Python bindings for Qt, our other important goal was to deliver the complete binding factory. fishes + fishing rodor PySide + Binding GeneratorAnd we care about your fishing skills too, so we try to document every part of the system. 16. Binding C++ librariesThings one must take care in the binding business: C++ object to Python wrapper association Inheritance Multiple inheritance and casting pointers Implicit type conversions Methods with multiple signatures Protected methods Function arguments that return values Virtual method overrides Object ownership 17. Shiboken Shiboken is the binding generator used to create the PySide bindings. It can generate bindings not only for Qt, but for any C++ library. The word means nothing at all. I was trying to remember some name and instead of returning an empty string my brain made that up. 18. Shiboken Ok, if you really need a meaning... Shi: Death Bo: Something, someone or somewhere Ken: Sword (Disclaimer: I dont know Japanese.) 19. Binding Generator Pedigree 20. Boost.PythonThe code created by the first Python binding generator used Boost.Python as sugar coating over the C Python API. In the beginning it was good because: Quick start Runtime speed Nevertheless, there was a bad part that showed up later: The size problemtemplates over templates over templates == huge binaries Lack of flexibilityindirect access to the C Python API became aproblem when flexibility was needed. 21. Binding Assembly Line (Again) API Extractor: collects information from library headers, merges it with the modifications and handwritten code defined in the type system description. Generator Runner: dynamic loader of generator front-ends. Shiboken: generator front-end that outputs CPython source code. 22. libshiboken Bindings generated with Shiboken will also need libshiboken (which is LGPL, by the way). libshiboken helps with: Association of C++ objectswith Python wrappers Multiple inheritance Implicit type conversions Virtual method overrides Object ownership 23. The Type System Description 24. Current Status 25. Getting Rid of Boost.Python Die Boost.Python! Die! 26. Working Qt Modules QtCore QtGui(almost done) QtNetwork and QtSvg(community effort! Go cgoncalves!) QtWebkit QtTest 27. And Now What? Bug Fixing A couple of important generator bugs must be fixed. Release We intend to release the Shiboken generated PySide in a month from now. 28. Future 29. Better Generation ProcessHelp others to help themselves. A tool to quick start binding development. A visual binding creation/editing tool. (Perhaps a QtCreator plugin.) 30. The Other Side Our focus is on Maemo but there are other worlds we care about. Linux Distros: were taken care by the community (Cheers to odyx! And to chaz6 for the build patches.) MacOS X: it needs a little love. Anyone with a good heart and a white laptop? Microsoft Windows: some work is already done, but still needs love. Lovers? 31. PythonizationOne of PySide requisites was to beAPI compatible with PyQt4.But we want to make PySides API more Pythonic.Great, but... what makes something Pythonic?What is good?What is right? What is real? 32. PSEPsPySide Enhancement Proposals Inspired by Pythons PEPs. Discussed with the community. 33. Questions? 34. Directions www.pyside.org at Freenode Marcelo Lira (setanta) [email protected] 35. Thanks :)