{"id":10353,"library":"winrt-windows-devices-enumeration","title":"Windows Devices Enumeration (WinRT)","description":"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.","status":"active","version":"3.2.1","language":"python","source_language":"en","source_url":"https://github.com/pywinrt/pywinrt","tags":["windows","winrt","asyncio","device enumeration","hardware"],"install":[{"cmd":"pip install winrt-windows-devices-enumeration","lang":"bash","label":"Install specific enumeration package"}],"dependencies":[],"imports":[{"symbol":"DeviceInformation","correct":"from winrt.windows.devices.enumeration import DeviceInformation"},{"symbol":"DeviceWatcher","correct":"from winrt.windows.devices.enumeration import DeviceWatcher"}],"quickstart":{"code":"import asyncio\nfrom winrt.windows.devices.enumeration import DeviceInformation\n\nasync def list_devices():\n    print(\"Searching for devices...\")\n    # Find all devices asynchronously\n    devices = await DeviceInformation.FindAllAsync()\n\n    if devices.size == 0:\n        print(\"No devices found.\")\n        return\n\n    print(f\"Found {devices.size} devices:\")\n    for i in range(devices.size):\n        device = devices.get_at(i)\n        print(f\"  [{i+1}] Name: {device.name}, Id: {device.id}\")\n\nif __name__ == \"__main__\":\n    # Ensure to run async code using asyncio\n    asyncio.run(list_devices())\n","lang":"python","description":"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`."},"warnings":[{"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.","message":"Version 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.","severity":"breaking","affected_versions":"<3.0.0 to >=3.0.0"},{"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.","message":"WinRT 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.","severity":"gotcha","affected_versions":"All versions"},{"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`.","message":"Version 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.","severity":"gotcha","affected_versions":"2.0.0"},{"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.","message":"In `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.","severity":"breaking","affected_versions":"<2.1.0 to >=2.1.0"}],"env_vars":null,"search_vec":"'3.2.1':47 'allow':22 'api':20 'asyncio':62 'avail':31 'cadenc':53 'current':44 'develop':24 'devic':2,30,63 'discov':26 'enumer':3,64 'follow':49 'hardwar':29,65 'larger':39 'manag':28 'namespac':14 'often':54 'packag':6 'part':36 'project':10,41 'provid':7 'python':9,23 'pywinrt':40,51 'releas':52 'runtim':18 'sdk':58 'system':35 'tie':55 'updat':59 'version':46 'window':1,17,34,57,60 'windows.devices.enumeration':13 'winrt':4,19,61","created_at":"2026-04-17T01:23:41.797969+00:00","updated_at":"2026-04-17T01:23:41.797969+00:00","problems":{"verify_error":"× Failed to build `winrt-runtime==3.2.1`\n  ├─▶ The build backend returned an error\n  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)\n\n      [stdout]\n      running bdist_wheel\n      running build\n      running build_py\n      copying src/winrt/system/__init__.py ->\n      build/"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.2.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/pywinrt/pywinrt","docs":"https://pywinrt.readthedocs.io","changelog":"https://github.com/pywinrt/pywinrt/blob/main/CHANGELOG.md","pypi":"https://pypi.org/project/winrt-windows-devices-enumeration/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}