PyWinRT is a set of Python projections for Windows Runtime (WinRT) APIs, allowing Python developers to access native Windows features. This specific package, `winrt-windows-devices-bluetooth`, provides access to Bluetooth-related functionalities from the `Windows.Devices.Bluetooth` namespace. It is currently at version 3.2.1 and follows a frequent release cadence, often aligned with Windows SDK and App SDK updates.
pip install winrt-windows-devices-bluetoothVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to retrieve information about the default Bluetooth adapter on a Windows system using the `BluetoothAdapter` class. It highlights the typical asynchronous pattern required for most WinRT API calls.
Consult the official migration guide (e.g., `scripts/2to3` on the PyWinRT GitHub repository) and update import paths and API usage patterns to v3.x.
Ensure your application environment is Windows. If cross-platform compatibility is needed, implement OS checks or alternative implementations for non-Windows platforms.
Always `await` calls to WinRT methods ending with `Async`. For synchronous execution in Python, use `.get()` or `.wait()` methods on the returned async object (available since v3.2.0): `BluetoothAdapter.GetDefaultAsync().get()`.
Ensure `pip install winrt-windows-devices-bluetooth` successfully installs `winrt>=3.0.0` (or the required version listed in PyPI metadata). If problems persist, try `pip install --upgrade winrt` before installing the projection.