PySide Shiboken FAQ: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(Rename category "LanguageBindings::PySide" -> "PySide")
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=PySide Shiboken <span class="caps">FAQ</span>s=
 
[[Category:PySide]]
 


This is a list of Frequently Asked Questions about Shiboken. Feel free to suggest new entries!
This is a list of Frequently Asked Questions about Shiboken. Feel free to suggest new entries!


==General==
== General ==


===What is Shiboken?===
=== What is Shiboken? ===


Shiboken is a GeneratorRunner plugin that outputs C++ code for CPython extensions. The first version of PySide had source code based on Boost templates. It was easier to produce code but a paradigm change was needed, as the next question explains.
Shiboken is a GeneratorRunner plugin that outputs C++ code for CPython extensions. The first version of PySide had source code based on Boost templates. It was easier to produce code but a paradigm change was needed, as the next question explains.


===Why did you switch from Boost.Python to Shiboken?===
=== Why did you switch from Boost.Python to Shiboken? ===


The main reason was the size reduction. Boost.Python makes excessive use of templates resulting in a significant increase of the binaries size. On the other hand, as Shiboken generates CPython code, the resulting binaries are smaller.
The main reason was the size reduction. Boost.Python makes excessive use of templates resulting in a significant increase of the binaries size. On the other hand, as Shiboken generates CPython code, the resulting binaries are smaller.


==Creating bindings==
== Creating bindings ==


===Can I wrap non-Qt libraries?===
=== Can I wrap non-Qt libraries? ===


Yes. Check Shiboken source code for an example (libsample).
Yes. Check Shiboken source code for an example (libsample).


===Is there any runtime dependency on the generated binding?===
=== Is there any runtime dependency on the generated binding? ===


Yes. Only libshiboken, and the obvious Python interpreter and the C++ library that is being wrapped.
Yes. Only libshiboken, and the obvious Python interpreter and the C++ library that is being wrapped.


===What do I have to do to create my bindings?===
=== What do I have to do to create my bindings? ===
 
Most of the work is already done by the <span class="caps">API</span> Extractor. The developer creates a typesystem file with any customization wanted in the generated code, like removing classes or changing method signatures. The generator will output the .h and .cpp files with the CPython code that will wrap the target library for python.
 
===Is there any recommended build system?===
 
Both <span class="caps">API</span> Extractor and generator uses and recommends the CMake build system.


===Can I write closed-source bindings with the generator?===
Most of the work is already done by the API Extractor. The developer creates a typesystem file with any customization wanted in the generated code, like removing classes or changing method signatures. The generator will output the .h and .cpp files with the CPython code that will wrap the target library for python.


Yes, as long as you use a <span class="caps">LGPL</span> version of Qt, due to runtime requirements.
=== Is there any recommended build system? ===


===What is ‘inject code’?===
Both API Extractor and generator uses and recommends the CMake build system.


That’s how we call customized code that will be injected into the generated at specific locations. They are specified inside the typesytem.
=== Can I write closed-source bindings with the generator? ===


===Categories:===
Yes, as long as you use a LGPL version of Qt, due to runtime requirements.


* [[:Category:LanguageBindings|LanguageBindings]]
=== What is ‘inject code’? ===
** [[:Category:LanguageBindings::PySide|PySide]]

Latest revision as of 03:31, 5 June 2016


This is a list of Frequently Asked Questions about Shiboken. Feel free to suggest new entries!

General

What is Shiboken?

Shiboken is a GeneratorRunner plugin that outputs C++ code for CPython extensions. The first version of PySide had source code based on Boost templates. It was easier to produce code but a paradigm change was needed, as the next question explains.

Why did you switch from Boost.Python to Shiboken?

The main reason was the size reduction. Boost.Python makes excessive use of templates resulting in a significant increase of the binaries size. On the other hand, as Shiboken generates CPython code, the resulting binaries are smaller.

Creating bindings

Can I wrap non-Qt libraries?

Yes. Check Shiboken source code for an example (libsample).

Is there any runtime dependency on the generated binding?

Yes. Only libshiboken, and the obvious Python interpreter and the C++ library that is being wrapped.

What do I have to do to create my bindings?

Most of the work is already done by the API Extractor. The developer creates a typesystem file with any customization wanted in the generated code, like removing classes or changing method signatures. The generator will output the .h and .cpp files with the CPython code that will wrap the target library for python.

Is there any recommended build system?

Both API Extractor and generator uses and recommends the CMake build system.

Can I write closed-source bindings with the generator?

Yes, as long as you use a LGPL version of Qt, due to runtime requirements.

What is ‘inject code’?