All Python samples use generated bindings and an installed dynwinrt runtime.
Install dynwinrt and dynwinrt-codegen from PyPI, or build both from this
checkout, then follow the sample's README. Most samples use generate.ps1, then
python -m pip install -e .\generated, then run.ps1 with the same interpreter;
the async-events README provides direct generation and run commands.
Sources are under generated\src\generated; installed imports
remain generated. After upgrading from preview.23 or earlier, regenerate the
complete project and reinstall it instead of adding the old output parent to
the import path.
Samples share the import name generated; install the selected sample again
when switching samples in a shared interpreter.
| Sample | Demonstrates |
|---|---|
async-file-io |
Temporary files, storage interfaces, and native asyncio |
async-events |
Same-thread notifications, TaskGroup cleanup, and native async file I/O |
ocr-image |
Self-contained image creation, bitmap decoding, and Windows OCR |
app-lifecycle-single-instance |
Multi-process activation redirection with Windows App SDK AppLifecycle |
cryptography |
SHA-256, IBuffer, text encoding, and hex conversion |
interface-implementation |
Standalone Python-backed WinRT interfaces, native IBackgroundTask calls, and multi-interface lifetime |
device-watcher |
Device enumeration and thread-safe typed event subscriptions |
text-to-speech |
asyncio, speech synthesis, media playback, and typed events |
app-notification |
Windows App SDK bootstrap, notification builder, display, activation, and cleanup |
winui-hello-world |
Minimal WinUI 3 XAML, controls, events, STA, and projected lifetime management |
custom-winmd-codegen |
Generate, type, and import a Python package from an external WinMD |
winui-tic-tac-toe |
XAML, a Python-defined WinUI control, native layout overrides, and Fluent resources |
winui-tic-tac-toe-code-only |
A larger programmatic WinUI application without XAML |
The Windows App SDK samples require matching metadata, runtime packages, and a
bootstrap DLL. Their winapp.yaml configuration is already checked in, so
winapp restore prepares those inputs and the sample generate.ps1 creates
Python bindings from the resulting metadata lockfile. The stock Windows samples
auto-detect the newest installed Windows SDK Windows.winmd.