{"id":10355,"library":"winrt-windows-devices-radios","title":"WinRT Windows Devices Radios","description":"winrt-windows-devices-radios is a Python projection of a subset of Windows Runtime (WinRT) APIs, specifically those related to managing wireless radios like Wi-Fi and Bluetooth. It allows Python applications to interact with system hardware for radio control on Windows. Part of the broader `pywinrt` project, it is currently at version 3.2.1 and receives regular updates corresponding to new Windows SDK releases and `pywinrt` core improvements.","status":"active","version":"3.2.1","language":"python","source_language":"en","source_url":"https://github.com/pywinrt/pywinrt","tags":["windows","winrt","interop","hardware","radios","bluetooth","wifi","network"],"install":[{"cmd":"pip install winrt-windows-devices-radios","lang":"bash","label":"Install specific package"},{"cmd":"pip install pywinrt","lang":"bash","label":"Install all WinRT packages"}],"dependencies":[],"imports":[{"note":"WinRT types are typically imported directly from their module path.","wrong":"import winrt.windows.devices.radios.Radio","symbol":"Radio","correct":"from winrt.windows.devices.radios import Radio"},{"symbol":"RadioState","correct":"from winrt.windows.devices.radios import RadioState"}],"quickstart":{"code":"import asyncio\nfrom winrt.windows.devices.radios import Radio, RadioState\n\nasync def list_radios():\n    try:\n        radios = await Radio.get_radios_async()\n        if not radios:\n            print(\"No radios found.\")\n            return\n\n        print(f\"Found {len(radios)} radios:\")\n        for radio in radios:\n            print(f\"  Name: {radio.name}\")\n            print(f\"  Kind: {radio.kind}\")\n            print(f\"  State: {radio.state}\")\n            # Example of setting state (requires appropriate user permissions)\n            # if radio.state == RadioState.ON:\n            #     print(f\"  Attempting to turn OFF {radio.name}...\")\n            #     # await radio.set_state_async(RadioState.OFF)\n            #     # print(f\"  Turned OFF {radio.name}\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Ensure you are running on Windows with necessary permissions.\")\n\nif __name__ == \"__main__\":\n    # os.environ.get('WINRT_DEBUG', 'false') # Example for auth check if needed\n    asyncio.run(list_radios())\n","lang":"python","description":"This quickstart demonstrates how to enumerate available wireless radios (Wi-Fi, Bluetooth) and their current state using the WinRT API. It requires an `asyncio` event loop as most WinRT operations are asynchronous."},"warnings":[{"fix":"Consult the `pywinrt` migration guide for updating code from v2.x to v3.x. Key changes include importing `box_value` from `winrt.system` and using `obj.as_(TargetType)`.","message":"Version 3.0.0 introduced significant breaking changes, including a new `winrt.runtime` module, changes to boxing/unboxing functions, and how `winrt.system.Object` methods like `as_()` are used. Refer to the migration guide for details.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Ensure your development and deployment environment is running Windows. For cross-platform solutions, consider platform-agnostic alternatives.","message":"This library is a projection of Windows Runtime (WinRT) APIs and is therefore strictly Windows-only. Attempting to install or run it on non-Windows operating systems will result in `ImportError` or `ModuleNotFoundError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use `await` with WinRT async methods and ensure your application runs within an `asyncio` event loop (e.g., by calling `asyncio.run()` for top-level async functions).","message":"Many WinRT methods are asynchronous, indicated by names ending in `_async` (e.g., `get_radios_async`). These methods return `IAsyncOperation` or `IAsyncAction` objects and must be `await`ed within an `asyncio` event loop.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'3.2.1':60 'allow':36 'api':21 'applic':38 'bluetooth':34,80 'broader':52 'control':46 'core':73 'correspond':65 'current':57 'devic':3,8 'fi':32 'hardwar':43,78 'improv':74 'interact':40 'interop':77 'like':29 'manag':26 'network':82 'new':67 'part':49 'project':13,54 'python':12,37 'pywinrt':53,72 'radio':4,9,28,45,79 'receiv':62 'regular':63 'relat':24 'releas':70 'runtim':19 'sdk':69 'specif':22 'subset':16 'system':42 'updat':64 'version':59 'wi':31 'wi-fi':30 'wifi':81 'window':2,7,18,48,68,75 'winrt':1,6,20,76 'winrt-windows-devices-radio':5 'wireless':27","created_at":"2026-04-17T01:23:41.915741+00:00","updated_at":"2026-04-17T01:23:41.915741+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-radios/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking"],"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}}