Repository navigation
Improve Python projection ergonomics and add WinRT samples - #107
Merged
leileizhang (lei9444) merged 17 commits intoAug 27, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Mixed-language test coverageWorkflow status: ✅ Passed
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 565c4300-9e07-40c2-8ad3-875138379a86
Kai Tao (vanzue)
approved these changes
Aug 27, 2026
leileizhang (lei9444)
deleted the
feature/python-samples-and-project-as
branch
August 27, 2026 07:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improve Python projection ergonomics end to end: add safe
project_as, normalize WinMD overloads, make RuntimeClass/interface typing sound, and provide nine runnable WinRT/Windows App SDK samples.Projection and typing
dynwinrt.project_as(value, Type)for non-consuming projection of rawObject/IInspectablevalues or existing wrappersOSErrorproject_as(raw, RuntimeClass); usewrapper.as_interface(Interface)orInterface.from_value(raw)for interface viewsas_interface()Literal[False]Generated API ergonomics
*Overload*,*WithOptions, and numeric suffixes when a canonical base method existson_*/off_*, idempotentsubscribe_*, and reentrancy-safeonce_*event APIsPython samples
async-file-ioocr-imageapp-lifecycle-single-instancecryptographydevice-watchertext-to-speechapp-notificationwinui-hello-worldcustom-winmd-codegenThe samples include generation/run scripts, prerequisites, cleanup guidance, and deterministic validation paths. File I/O, OCR, TTS, and WinUI use explicit or structurally proven interface conversions. Windows App SDK samples accept exact major/minor version arguments. AppNotification guarantees registration cleanup, and custom OCR images no longer assume the built-in test text.
The Python GSMTC sample was removed because a normal
python.exeprocess does not contain the matching fusion-manifest identity required for the restrictedglobalMediaControlcapability. A future sample needs an identity-aware process that actually hosts Python.Validation
cargo test -p dynwinrt-codegen: passedstubtest: passedcompileallpassedproject_as(raw, RuntimeClass)success and interface/intrejection paths validated in runtime and strict mypySecond review fixes
from_value()a true classmethod returning the requested subclassProjection API responsibilities
project_as(raw, RuntimeClass)converts rawObject/IInspectablevalues to generated RuntimeClasseswrapper.as_interface(Interface)queries an interface from an existing wrapperInterface.from_value(raw)queries an interface from a rawDynWinRTValuefrom_value(), andproject_as()rejects interface classes