Registry / http-networking / winrt-runtime

winrt-runtime

JSON →
library3.2.1pypypiunverified

winrt-runtime is the foundational Python package providing the runtime support and the `winrt.system` module for interacting with Windows Runtime (WinRT) APIs. It is part of a community-supported fork of the original pywinrt project, which provides modular bindings for individual Windows SDK namespaces (e.g., `winrt-Windows.Foundation`). The library, currently at version 3.2.1, is actively maintained with frequent updates, enabling Python developers to access a wide range of Windows OS features, hardware, and to build WinUI applications.

pip install winrt-runtime
INSTALL
IMPORT
SIG · WINRT-RUNTIME
W
winrt-runtime
http-networkingpythonv3.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.940 runs
build_error
glibc
py 3.103.940 runs
build_error
Code
Verified usage

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

Object
from winrt.system import Object
SpeechSynthesizer
from winrt.windows.media.speechsynthesis import SpeechSynthesizer
Uri
from winrt.windows.foundation import Uri
import winrt.windows.foundation as wf; wf.Uri
While aliasing works, direct import of specific classes is often preferred for clarity.

This quickstart demonstrates how to use `winrt-runtime` along with specific WinRT namespace packages to synthesize and play speech. It utilizes asynchronous WinRT APIs with Python's `asyncio`. Make sure to install `winrt-Windows.Media.SpeechSynthesis` and `winrt-Windows.Media.Playback` for this example to run.

import asyncio from winrt.system import Object from winrt.windows.media.speechsynthesis import SpeechSynthesizer from winrt.windows.media.playback import MediaPlayer, MediaPlayerAudioCategory async def speak_hello_world(): synth = SpeechSynthesizer() # Asynchronous operation, must be awaited stream = await synth.synthesize_text_to_stream_async("Hello, World from WinRT!") media_ended_event = asyncio.Event() loop = asyncio.get_running_loop() def on_media_ended(sender: MediaPlayer, args: Object): loop.call_soon_threadsafe(media_ended_event.set) player = MediaPlayer() player.audio_category = MediaPlayerAudioCategory.SPEECH player.set_stream_source(stream) player.add_media_ended(on_media_ended) player.play() await media_ended_event.wait() print("Speech finished.") if __name__ == "__main__": # Ensure required namespace packages are installed: # pip install winrt-Windows.Media.SpeechSynthesis winrt-Windows.Media.Playback asyncio.run(speak_hello_world())
Debug
Known issues
breakingStarting with v3.0.0, the Python WinRT bindings transitioned from monolithic `winrt` or `winsdk` packages to a modular distribution. Each WinRT namespace (e.g., `Windows.Foundation`, `Windows.Media.SpeechSynthesis`) now requires its own `winrt-Windows.Namespace` package installation.
fix
Instead of `pip install winrt` or `pip install winsdk`, install `winrt-runtime` for the base runtime and then `pip install winrt-Windows.MyNamespace` for each specific WinRT namespace you need. Update imports from `winsdk.windows.some_module` or `winrt.windows.some_module` to `from winrt.windows.some_module import SomeClass`.
affects: >=3.0.0
deprecatedThe `winsdk` package, which was a community-maintained fork after the original `winrt` package, is now deprecated in favor of the modular `winrt-runtime` and `winrt-Windows.*` package structure.
fix
Migrate to `winrt-runtime` and the specific `winrt-Windows.*` namespace packages. This involves adjusting both installation commands and import statements.
affects: All `winsdk` versions
gotchaWinRT APIs often involve asynchronous operations, which require proper integration with Python's `asyncio` event loop. Incorrect handling can lead to blocking or unexpected behavior.
fix
Always `await` WinRT asynchronous methods (those ending with `_async`). For events that signal completion (like `MediaEnded`), use `asyncio.Event` and ensure callbacks are scheduled on the event loop with `loop.call_soon_threadsafe`.
affects: All
Upgrade
Version history
3.2.1latest on PyPI · released Jun 6, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
97 hits · last 30 days
node
88
Resources
winrt-runtime — pip install winrt-runtime · libregistry