{"id":8783,"library":"winrt-windows-foundation","title":"WinRT Windows Foundation API","description":"winrt-windows-foundation is a Python package that provides a projection of the core Windows Runtime (WinRT) Foundation APIs, enabling Python developers to interact with fundamental Windows features and UWP application components. As of version 3.2.1, it offers enhanced asyncio integration, support for the Python buffer protocol, and streamlined API access. Releases are frequent, often coinciding with updates to the Windows SDK and Windows App SDK.","status":"active","version":"3.2.1","language":"python","source_language":"en","source_url":"https://github.com/pywinrt/pywinrt","tags":["windows","winrt","asyncio","interop","uwp"],"install":[{"cmd":"pip install winrt-windows-foundation","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"Uri","correct":"from winrt.windows.foundation import Uri"},{"symbol":"IAsyncOperation","correct":"from winrt.windows.foundation import IAsyncOperation"},{"symbol":"PropertyValue","correct":"from winrt.windows.foundation import PropertyValue"},{"note":"The `box` and `unbox` functions were moved from `winrt.windows.foundation.interop` to `winrt.system` in v3.0.0, and split into type-specific functions like `box_int32`, `box_string`, etc.","wrong":"from winrt.windows.foundation.interop import box","symbol":"box_int32","correct":"from winrt.system import box_int32"}],"quickstart":{"code":"from winrt.windows.foundation import Uri\n\ndef main():\n    # Create a WinRT Uri object\n    url = Uri(\"https://www.microsoft.com/python\")\n\n    print(f\"Original URI: {url.AbsoluteUri}\")\n    print(f\"Scheme Name: {url.SchemeName}\")\n    print(f\"Domain: {url.Domain}\")\n    print(f\"Path: {url.Path}\")\n\n    # Demonstrate a simple comparison\n    another_url = Uri(\"https://www.microsoft.com/python\")\n    if url == another_url:\n        print(\"URIs are equal.\")\n\nif __name__ == \"__main__\":\n    main()","lang":"python","description":"This quickstart demonstrates how to create and interact with a basic WinRT Uri object from the Windows.Foundation namespace, showcasing property access and object comparison."},"warnings":[{"fix":"Review the 'scripts/2to3/README.md' in the pywinrt GitHub repository for migration steps. Update import paths and code relying on `Object` comparisons or `box/unbox` functions.","message":"Version 3.0.0 introduced significant breaking changes, including major changes to module structure, `winrt.system.Object` behavior (e.g., for equality), and the relocation/refactoring of `box`/`unbox` functions. Consult the migration guide for details.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Uninstall `winrt-runtime` if it's installed and rely solely on `winrt-windows-foundation` (and other specific `winrt-*` packages) for runtime components.","message":"The separate `winrt-runtime` PyPI package is no longer needed nor compatible with `winrt-windows-foundation` versions 3.0.0 and above. Its functionality is now integrated directly into `winrt-*` packages.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Upgrade to `winrt-windows-foundation v3.1.0` or a later version to ensure correct iteration behavior.","message":"Before `v3.1.0`, `IIterator.__iter__()` contained critical bugs that could lead to crashes or incorrect object returns, especially when iterating over WinRT collections.","severity":"gotcha","affected_versions":"<3.1.0"},{"fix":"Update imports to `from winrt.system import box_int32` (or the appropriate type) and call the new type-specific functions.","message":"The `box` and `unbox` helper functions, previously found in `winrt.windows.foundation.interop`, were moved to `winrt.system` and split into type-specific functions (e.g., `box_int32`, `unbox_string`) in `v3.0.0`.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Do not attempt to install `winrt-windows-foundation==2.0.0`. Use `winrt-windows-foundation==2.0.1` or a later compatible version instead.","message":"The `v2.0.0` release was never published to PyPI due to compilation issues. If you intend to use a `v2` release, `v2.0.1` was the first stable and published version.","severity":"gotcha","affected_versions":"2.0.0"}],"env_vars":null,"search_vec":"'3.2.1':41 'access':56 'api':4,24,55 'app':70 'applic':36 'asyncio':45,74 'buffer':51 'coincid':61 'compon':37 'core':19 'develop':27 'enabl':25 'enhanc':44 'featur':33 'foundat':3,8,23 'frequent':59 'fundament':31 'integr':46 'interact':29 'interop':75 'offer':43 'often':60 'packag':12 'project':16 'protocol':52 'provid':14 'python':11,26,50 'releas':57 'runtim':21 'sdk':67,71 'streamlin':54 'support':47 'updat':63 'uwp':35,76 'version':40 'window':2,7,20,32,66,69,72 'winrt':1,6,22,73 'winrt-windows-found':5","created_at":"2026-04-16T17:03:58.266283+00:00","updated_at":"2026-04-16T17:03:58.266283+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-foundation/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":[],"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}}