Registry / serialization / shiboken6

shiboken6

JSON →
library6.11.2pypypi✓ verified 22d ago

Shiboken6 is a core component of Qt for Python (PySide6), responsible for generating Python bindings for C++ libraries. It enables seamless, low-level interaction between Python and C++ objects, allowing Python to call C++ functions and access C++ data structures directly. It is currently at version 6.11.0 and is actively maintained, with updates released in conjunction with PySide6 and Qt releases.

pip install shiboken6
INSTALL
IMPORT
SIG · SHIBOKEN6
S
shiboken6
serializationpythonv6.11.2
Install
1.6s avg
Import
238ms
Disk
17MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.11.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.238s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wrapInstance
from shiboken6 import wrapInstance
from shiboken import wrapInstance
For Qt6/PySide6, the module name is 'shiboken6'. 'shiboken' refers to the Qt5/PySide2 era.
getCppPointer
from shiboken6 import getCppPointer
from shiboken import getCppPointer
For Qt6/PySide6, the module name is 'shiboken6'. 'shiboken' refers to the Qt5/PySide2 era.

Shiboken6 is primarily used for low-level interaction between Python and C++ objects, specifically within the Qt/PySide ecosystem. This example demonstrates how to retrieve the underlying C++ pointer from a PySide6 QObject using `getCppPointer`. While `wrapInstance` is also a key function, its typical use involves receiving a raw C++ pointer from an external C++ source, which is difficult to simulate in a simple, self-contained Python snippet. Note that `PySide6` is a prerequisite to run this quickstart.

from shiboken6 import getCppPointer, wrapInstance # PySide6 is required to run this example. Install with: pip install PySide6 from PySide6.QtCore import QObject # Shiboken6 is typically used with PySide6 objects obj = QObject() obj.setObjectName("MyQObject") # Get the underlying C++ pointer from a PySide6 object cpp_ptr_long = getCppPointer(obj) print(f"Python QObject: {obj}") print(f"C++ pointer (long): {cpp_ptr_long:#x}") print("\n--- Conceptual use of wrapInstance ---") print("wrapInstance is used to convert a raw C++ pointer into a Python object.") print("Example: `python_object = wrapInstance(raw_cpp_ptr, PySide6.ClassName, ownership=shiboken6.Ownership.CppOwnership)`") print("It requires a valid C++ pointer (e.g., from an external C++ library call)") print("and the expected PySide6 class type for correct wrapping. Careful memory") print("management with `shiboken6.Ownership` is crucial to prevent crashes or leaks.")
shiboken6 --version
Debug
Known issues
breakingWhen migrating from PySide2/Qt5 to PySide6/Qt6, the Shiboken module name changed from `shiboken` to `shiboken6`. Direct imports or references to `shiboken` will result in `ModuleNotFoundError`.
fix
Update all `import shiboken` or `from shiboken import ...` statements to use `shiboken6` instead. For example, `from shiboken import wrapInstance` becomes `from shiboken6 import wrapInstance`.
affects: <6.0.0
gotchaUsing `shiboken6.wrapInstance` incorrectly, especially regarding memory ownership, can lead to memory leaks, double-frees, or application crashes. If `ownership` is not handled correctly, Python's garbage collector might attempt to delete a C++ object managed externally or prematurely.
fix
Always explicitly define `ownership` when using `wrapInstance`. For C++-managed objects, use `ownership=shiboken6.Ownership.CppOwnership`. For objects where Python should take ownership and manage its lifecycle, use `ownership=shiboken6.Ownership.PythonOwnership`.
affects: All
gotchaShiboken6 is a low-level binding tool; it is not intended for general application development. Directly interacting with `shiboken6` beyond simple debugging with `getCppPointer` or specific C++/Python interoperability for custom extensions often indicates a deeper misunderstanding or an overly complex solution.
fix
Ensure you understand the purpose of `shiboken6`. For standard GUI development, interact primarily with the PySide6 API. Reserve direct `shiboken6` usage for advanced scenarios involving raw C++ pointers or custom C++ extensions that integrate with PySide6.
affects: All
Upgrade
Version history
6.11.2latest on PyPI · released Aug 18, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources
shiboken6 — pip install shiboken6 · libregistry