Registry / devops / winrt-windows-devices-enumeration

winrt-windows-devices-enumeration

JSON →
library3.2.1pypypiunverified

This package provides the Python projection for the Windows.Devices.Enumeration namespace of the Windows Runtime (WinRT) APIs. It allows Python developers to discover and manage hardware devices available on a Windows system. Part of the larger PyWinRT project, it is currently at version 3.2.1 and follows the PyWinRT release cadence, often tied to Windows SDK updates.

pip install winrt-windows-devices-enumeration
INSTALL
IMPORT
SIG · WINRT-WINDOWS-DEVI
W
winrt-windows-devices-enumeration
devopspythonv3.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.910 runs
build_error
glibc
py 3.103.910 runs
build_error
Code
Verified usage

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

DeviceInformation
from winrt.windows.devices.enumeration import DeviceInformation
DeviceWatcher
from winrt.windows.devices.enumeration import DeviceWatcher

This quickstart demonstrates how to asynchronously list all discoverable devices using the `DeviceInformation.FindAllAsync()` method. It prints the name and ID of each found device. Remember that WinRT operations are often asynchronous and require `await` and `asyncio`.

import asyncio from winrt.windows.devices.enumeration import DeviceInformation async def list_devices(): print("Searching for devices...") # Find all devices asynchronously devices = await DeviceInformation.FindAllAsync() if devices.size == 0: print("No devices found.") return print(f"Found {devices.size} devices:") for i in range(devices.size): device = devices.get_at(i) print(f" [{i+1}] Name: {device.name}, Id: {device.id}") if __name__ == "__main__": # Ensure to run async code using asyncio asyncio.run(list_devices())
Debug
Known issues
breakingVersion 3.0.0 introduced significant breaking changes, including a new `winrt.runtime` module, changes to `box`/`unbox` functions (moved to `winrt.system`), and the introduction of `winrt.system.Object.as_()` for type casting. Older code will likely fail.
fix
Consult the official migration guide (e.g., `pywinrt/scripts/2to3/README.md` on GitHub). Update imports and adjust type casting/boxing logic. `box`/`unbox` are now in `winrt.system`, and `Object.as_()` replaces previous casting patterns.
affects: <3.0.0 to >=3.0.0
gotchaWinRT asynchronous operations (methods ending in `Async`, e.g., `FindAllAsync()`) return awaitable objects. Forgetting to `await` them will result in an `Awaitable` object instead of the final result, leading to type errors if you try to use it directly.
fix
Always `await` asynchronous operations (e.g., `await obj.DoSomethingAsync()`). Ensure your code runs within an `async` function and is executed by `asyncio.run()`. From `v3.2.0`, you can use `obj.DoSomethingAsync().get()` or `obj.DoSomethingAsync().wait()` for synchronous calls.
affects: All versions
gotchaVersion 2.0.0 was never published to PyPI due to compilation issues. If you target `2.x`, attempting to install `2.0.0` will fail or result in an outdated package.
fix
Always install `winrt-windows-devices-enumeration==2.0.1` (or a later `2.x` release) if you need a specific version in the 2.x range, instead of `2.0.0`.
affects: 2.0.0
breakingIn `v2.1.0`, the handling of static events was changed, moving them to the metaclass of the respective WinRT class. Code accessing static events might need adjustment.
fix
Access static events directly on the class (e.g., `MyWinRTClass.StaticEvent += handler`) rather than through instances or older patterns. Refer to updated `pywinrt` documentation for specific event handling examples.
affects: <2.1.0 to >=2.1.0
Upgrade
Version history
3.2.1latest on PyPI · released Jun 6, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
winrt-windows-devices-enumeration — pip install winrt-windows-devices-enumeration · libregistry