diff --git a/eng/release/RELEASE_NOTES.md b/eng/release/RELEASE_NOTES.md index 7375c374..f271b777 100644 --- a/eng/release/RELEASE_NOTES.md +++ b/eng/release/RELEASE_NOTES.md @@ -1,6 +1,6 @@ -## Prerelease v0.1.0-preview.23 +## Prerelease v0.1.0-preview.24 -This preview improves Python apartment lifetime safety, collection comparisons and write contracts, Object value conversion, and generated-package installation on Windows. It also strengthens Python callback, overload, and typing contracts, and fixes generated JavaScript/TypeScript interface inputs and async-with-progress Promises. These changes are relative to preview.22. +This preview improves Python package installation, async notification handling, resource cleanup, and generated API contracts. It also adds packaged Windows App SDK Bootstrap configuration for Python and Node.js. These changes are relative to preview.23. ## Packages and installation @@ -16,74 +16,66 @@ This preview improves Python apartment lifetime safety, collection comparisons a - **Package versions:** Use the same runtime and codegen version for each language. - **Upgrade cleanup:** Clean old generated bindings before using the new version. +Installation commands for this preview, once published: + ```powershell -npm install @microsoft/dynwinrt@0.1.0-preview.23 -npm install -D @microsoft/dynwinrt-codegen@0.1.0-preview.23 -python -m pip install --pre "dynwinrt==0.1.0rc23" "dynwinrt-codegen==0.1.0rc23" +npm install @microsoft/dynwinrt@0.1.0-preview.24 +npm install -D @microsoft/dynwinrt-codegen@0.1.0-preview.24 +python -m pip install --pre "dynwinrt==0.1.0rc24" "dynwinrt-codegen==0.1.0rc24" ``` ## Highlights -### Python apartment and native-owner safety +### Python src package layout + +- Generated Python packages use a standard `src` layout so editable installs work with static type checkers. ([#228](https://github.com/microsoft/dynwinrt/pull/228)) + +### Windows App SDK Bootstrap packaging + +- Generated Python and Node.js packages can include Bootstrap DLLs and SDK configuration for initialization without hard-coded versions or DLL paths. ([#225](https://github.com/microsoft/dynwinrt/pull/225)) -- Release library-owned COM references before the final managed apartment close. `projected_lifetime_scope()` is optional. -- Block final apartment teardown inside synchronous native callbacks. Preserve guards for recovery. -- Keep nested initialization counts balanced, including initialization during cleanup. Preserve failed closes for retry. -- Reject wrong-thread apartment closes without changing state. Preserve dropped guards for owner-thread recovery. -- Refuse cleanup of unsafe pending async owners. Cleanup does not silently cancel work. +### Python AsyncEventScope notifications -Recover deferred guards with `RoApartment.recover_pending()` on the owner thread. Use `retry_pending_apartment_close()` for failed unnamed closes. +- `AsyncEventScope` manages async handlers for same-thread notifications and cleans up their subscriptions and tasks. ([#229](https://github.com/microsoft/dynwinrt/pull/229)) -### Python collections and Object values +### Python interface close() and with support -- Match class, interface, and raw references by COM identity in collection comparisons. Equality and hashing outside collections stay unchanged. -- Preserve mapping entry counts and ordinary Python value equality. Raw `Object` collections do not implicitly box or unbox. -- Align bulk-write input types with item assignment. Preserve native member names and dispatch. -- Return the stored read projection from `setdefault()`. Do not consume the caller's input. -- Add explicit Object boxing with `to_winrt_object()`. Generated Object positions remain native by default. -- Extend `unbox_object()` to DateTime, TimeSpan, geometry, and arrays. Retain exact WinRT types when requested. -- Add opt-in Object map views with `object_value_view()`. Reads unbox and writes box. `.raw` stays native. +- Closable stream interfaces such as `IRandomAccessStream` now support `close()` and `with` for resource cleanup. ([#233](https://github.com/microsoft/dynwinrt/pull/233)) -### Python projection contracts +### Python XAML string keys -- Project typed delegate arguments from native signatures. Include typed `MapChanged` callbacks. -- Keep `.py` and `.pyi` overloads and aliases consistent. Accept compatible interface inputs through QueryInterface. -- Default `.pyi` outputs to non-null. Preserve supported nullable results, including XML DOM results. -- Reject native null in stock JSON writes before mutation. Keep valid nulls in custom generic collections. -- Validate interface construction and arrays before retaining native references. Reject Async receivers in `call_0()` and `call_1()`. -- Add named apartment constants and clearer runtime errors. -- Fix strict click-handler typing in both Python Tic-Tac-Toe samples. +- WinUI and UWP `ResourceDictionary` bindings now accept Python string keys, with matching type hints. ([#221](https://github.com/microsoft/dynwinrt/pull/221)) -### Python package generation and Windows paths +### Python constructor error diagnostics -- Improve Windows installs with shorter module and staging paths. Keep public type names and namespace exports unchanged. -- Record the producer version in `.dynwinrt-generator.json`. Reject incompatible output before changing files. Keep same-version incremental generation. -- Warn when final generated paths reach the legacy Windows limit. +- Python constructor matching errors now show supplied argument types and accepted signatures. ([#230](https://github.com/microsoft/dynwinrt/pull/230)) -### JavaScript/TypeScript and shared code generation +### Nullable Python DetachStream return types -- Reuse the projected Promise for repeated async-with-progress `.toPromise()` calls. Avoid duplicate native completion registration. -- Generate real interface-method aliases with matching TypeScript declarations. Keep existing overload dispatch unchanged. -- Handle explicitly selected non-generic WinRT delegates in JavaScript and Python. Reject malformed or open-generic delegate roots. +- Type hints for `DataWriter.detach_stream()` and `DataReader.detach_stream()` now correctly allow `None`. ([#231](https://github.com/microsoft/dynwinrt/pull/231)) + +### Python from_bytes() crash fix after apartment teardown + +- Fix a `from_bytes()` crash when COM is uninitialized and initialized again before creating another buffer. ([#232](https://github.com/microsoft/dynwinrt/pull/232)) ## Upgrade notes -Upgrade runtime and codegen together. Regenerate bindings and rebuild/reinstall generated packages. Do not mix old bindings or stubs with the new runtime. +Upgrade runtime and codegen together, then regenerate and reinstall all bindings. + +- **Python layout:** Use a fresh or cleaned codegen-owned output directory; install the outer project, not `src`. Import names stay unchanged. +- **Direct source imports:** Point them at `\src`; Bootstrap discovery still requires installing the package. +- **Nullable streams:** Check `detach_stream()` results for `None`. +- **Async cleanup:** Keep COM apartments and projected lifetimes alive until `AsyncEventScope` exits. -- **Python lifecycle:** Balance each worker thread's apartment explicitly. `projected_lifetime_scope()` is optional. External COM references remain caller-owned. -- **Python regeneration:** Regenerate fully in a fresh or cleaned generated-output directory. Do not delete or edit only the producer stamp. Use namespace imports for shortened modules. -- **Python typing:** Regenerate `.py` and `.pyi` together. Guard nullable results before member access. SDK nullability facts are not universal. -- **Python collection defaults:** `setdefault()` returns the map's read projection. Raw `Object` maps return `DynWinRTValue | None`. Project or unbox results explicitly. -- **Python JSON:** Use `JsonValue.create_null_value()` for JSON null. Do not pass `None` to stock JSON collections. -- **Python Object conversion:** Plain `int` values box as Int32. Use tags or `PropertyType` for other types. Re-boxing does not preserve box identity. -- **JavaScript/TypeScript:** Regenerate wrappers for interface aliases and the progress Promise fix. A runtime-only upgrade does not update generated code. -- **Rust source compatibility:** Update exhaustive matches on `PropertyValueData` and `PropertyValueUnboxResult`. Handle new variants and `Unsupported(PropertyType)`. Keep `Null` and `NotPropertyValue` distinct. +See the [Python layout migration contract](https://github.com/microsoft/dynwinrt/blob/main/tools/dynwinrt-codegen/python/README.md#breaking-layout-upgrade-from-preview23-and-earlier) for details. ## Known boundaries -- **Experimental APIs:** Classic COM, flat Win32, and WinUI hosting remain experimental. -- **Collection producers:** Architecture-specific support limits remain unchanged. -- **ARM64 WinUI:** Native live coverage remains incomplete. -- **Embedded hosts:** Stop new calls and settle in-flight callbacks. Call `shutdown_python_callbacks()` before `Py_FinalizeEx`. Skipping this protocol leaves only best-effort protection. +- **Bootstrap deployment:** Bundled DLLs do not install Windows App Runtime; apps using Bootstrap must handle Runtime deployment, COM/Bootstrap initialization, and SDK redistribution requirements. +- **Async notifications:** `AsyncEventScope` requires a running asyncio loop on its owning thread; it does not provide cross-thread marshalling, WinUI pump integration, or synchronous-return/deferral support. +- **Experimental APIs:** Classic COM, flat Win32, and WinUI hosting remain experimental; Python targets WinRT only, and native ARM64 WinUI validation remains limited. +- **Collection producers:** Architecture-specific restrictions remain; see the [Python](https://github.com/microsoft/dynwinrt/blob/main/bindings/py/README.md#creating-winrt-collections) and [JavaScript](https://github.com/microsoft/dynwinrt/blob/main/bindings/js/README.md#creating-winrt-collections) support tables. +- **Windows paths:** Keep generated-project and environment paths short; [Windows path-length limits](https://github.com/microsoft/dynwinrt/blob/main/tools/dynwinrt-codegen/python/README.md#windows-path-length) still apply. +- **Embedded hosts:** Stop new callbacks, drain in-flight work, then call `shutdown_python_callbacks()` before finalizing Python. -For details, see the [Python runtime guide](https://github.com/microsoft/dynwinrt/blob/main/bindings/py/README.md), [Python codegen path guidance](https://github.com/microsoft/dynwinrt/blob/main/tools/dynwinrt-codegen/python/README.md#windows-path-length), and the [project README](https://github.com/microsoft/dynwinrt#readme). +Details: [Python runtime guide](https://github.com/microsoft/dynwinrt/blob/main/bindings/py/README.md), [JavaScript runtime guide](https://github.com/microsoft/dynwinrt/blob/main/bindings/js/README.md), [async-events sample](https://github.com/microsoft/dynwinrt/tree/main/samples/python/async-events), and [project README](https://github.com/microsoft/dynwinrt#readme).