Registry / communication / winrt-windows-devices-bluetooth

winrt-windows-devices-bluetooth

JSON →
library3.2.1pypypiunverified

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-bluetooth
INSTALL
IMPORT
SIG · WINRT-WINDOWS-DEVI
W
winrt-windows-devices-bluetooth
communicationpythonv3.2.1
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
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.920 runs
build_error
glibc
py 3.103.920 runs
build_error
Code
Verified usage

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

BluetoothAdapter
from winrt.windows.devices.bluetooth import BluetoothAdapter
from winrt_windows_devices_bluetooth import BluetoothAdapter
WinRT projections follow the WinRT namespace structure, not the PyPI package name.
BluetoothDevice
from winrt.windows.devices.bluetooth import BluetoothDevice
import winrt.windows.devices.bluetooth.BluetoothDevice
Directly importing a class from its full path without 'from ... import ...' is not idiomatic Python and may not work as expected with this projection.

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.

import asyncio from winrt.windows.devices.bluetooth import BluetoothAdapter async def get_bluetooth_adapter_info(): print("Attempting to get default Bluetooth adapter...") adapter = await BluetoothAdapter.GetDefaultAsync() if adapter: print(f"\nBluetooth Adapter Found:") print(f" Device ID: {adapter.DeviceId}") print(f" Is Low Energy Supported: {adapter.IsLowEnergySupported}") print(f" Is Central Role Supported: {adapter.IsCentralRoleSupported}") print(f" Is Peripheral Role Supported: {adapter.IsPeripheralRoleSupported}") print(f" Address: {adapter.BluetoothAddress:X}") else: print("No Bluetooth adapter found or enabled on this system.") print("Ensure Bluetooth is turned on in Windows settings.") if __name__ == "__main__": # Ensure asyncio event loop is running to await WinRT async operations asyncio.run(get_bluetooth_adapter_info())
Debug
Known issues
breakingSignificant breaking changes were introduced in v3.0.0, including a new `winrt.runtime` module, changes to `winrt.system.Object` behavior (e.g., `as_()`), and regeneration of all projections. Code written for v2.x will likely not work without modification.
fix
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.
affects: <3.0.0
gotchaPyWinRT is a projection of Windows Runtime APIs, meaning it only functions on Windows operating systems. Attempting to use it on Linux, macOS, or other platforms will result in `ImportError` or runtime errors because the underlying WinRT APIs are unavailable.
fix
Ensure your application environment is Windows. If cross-platform compatibility is needed, implement OS checks or alternative implementations for non-Windows platforms.
affects: all
gotchaMost WinRT APIs exposed through PyWinRT are asynchronous and return `IAsyncOperation` or `IAsyncAction` objects. Forgetting to `await` these objects will lead to `TypeError: 'coroutine' object is not awaited` or the async operation never completing.
fix
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()`.
affects: all
gotchaWhile `pip install winrt-windows-devices-bluetooth` will typically pull in the core `winrt` package as a dependency, issues can arise if the dependency is not correctly resolved or if an incompatible version of `winrt` is already installed. The specific projection package itself does not contain the core runtime logic.
fix
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.
affects: all
Upgrade
Version history
3.2.1latest on PyPI · released Jun 6, 2025
Audit
Dependencies
winrtrequiredCore runtime for all WinRT projections.
Agent activity
49 hits · last 30 days
node
44
OpenAI (training)
1
Resources
winrt-windows-devices-bluetooth — pip install winrt-windows-devices-bluetooth · libregistry