Registry /
serialization / winrt-windows-storage-streams
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
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DataWriter
✓ from winrt.windows.storage.streams import DataWriter
DataReader
✓ from winrt.windows.storage.streams import DataReader
InMemoryRandomAccessStream
✓ from winrt.windows.storage.streams import InMemoryRandomAccessStream
Buffer
✓ from winrt.windows.storage.streams import Buffer
✗ from winrt.system import Buffer
WinRT `Buffer` is in `windows.storage.streams`, not `system`.
This example demonstrates writing bytes to an `InMemoryRandomAccessStream` using a `DataWriter`, then seeking to the beginning, reading the data back with a `DataReader`, and converting the `IBuffer` result into Python bytes. It showcases fundamental stream operations and the use of async methods.
import asyncio
from winrt.windows.storage.streams import DataWriter, DataReader, InMemoryRandomAccessStream, Buffer
async def write_and_read_stream():
stream = InMemoryRandomAccessStream()
writer = DataWriter(stream)
# Write some bytes
data_to_write = b"Hello, WinRT Streams!"
writer.write_bytes(data_to_write)
await writer.store_async()
await writer.flush_async()
# Seek to the beginning of the stream and read
stream.seek(0)
reader = DataReader(stream)
await reader.load_async(stream.size)
read_buffer = reader.read_buffer(stream.size)
# Convert IBuffer to Python bytes using buffer protocol
read_bytes = bytes(read_buffer)
print(f"Original: {data_to_write.decode('utf-8')}")
print(f"Read: {read_bytes.decode('utf-8')}")
writer.close()
reader.close()
stream.close()
if __name__ == "__main__":
asyncio.run(write_and_read_stream())
Debug
Known issues
breakingVersion 3.0.0 introduced significant breaking changes, including a new `winrt.runtime` module, `winrt.system.Object.as_()` method, and `box_...`/`unbox_...` functions in `winrt.system`. Direct migration from older monolithic `winrt` or `winsdk` packages may require substantial code changes.fixRefer to the PyWinRT migration guide for specific details on adapting code to the new API surface. Update imports and API calls as necessary. [GitHub Release Notes (v3.0.0)]
affects: >=3.0.0
deprecatedThe previous monolithic `winrt` (Microsoft) and `winsdk` (community) packages are deprecated. The PyWinRT project now uses a modular approach, where each Windows SDK namespace (e.g., `Windows.Storage.Streams`) is a separate `winrt-*` PyPI package. Using older monolithic packages can lead to compatibility issues, especially with newer Python versions (>=3.10).fixMigrate to the modular `winrt-*` package structure. Install `winrt-runtime` and specific namespace packages like `winrt-windows-storage-streams`. Update imports from `winsdk.windows...` or `winrt.windows...` to `from winrt.windows...` after installing the new packages.
affects: <3.0.0 and any usage of `winsdk` or old `winrt`
gotchaThe `v2.0.0` release was not published to PyPI due to compilation issues. If targeting versions around `2.0.0`, ensure you use `v2.0.1` or newer.fixAvoid `v2.0.0`. If you need features from this release cycle, install `winrt-windows-storage-streams==2.0.1` or later. [GitHub Release Notes (v2.0.0)]
affects: 2.0.0
breaking`asyncio` cancellation is now propagated to WinRT asynchronous actions and operations being awaited. This changes how cancellation behaves for long-running WinRT tasks.fixReview code that interacts with `asyncio` tasks and WinRT async operations to ensure proper handling of cancellation signals. Ensure your application logic correctly responds to `asyncio.CancelledError`.
affects: >=3.2.0
gotchaPrior to `v3.1.0`, there were issues with `IIterator.__iter__()` returning invalid objects and potentially causing crashes. This primarily affected iteration over WinRT collections.fixUpgrade to `winrt-windows-storage-streams==3.1.0` or a newer version to benefit from stability fixes for collection iteration.
affects: <3.1.0
Upgrade
Version history
3.2.1latest on PyPI · released Jun 6, 2025
Audit
Dependencies
winrt-runtimerequiredProvides the core runtime support for all PyWinRT projections.
winrt-windows.foundationoptionalOften used for core types like IAsyncOperation and IClosable.
winrt-windows.foundation.collectionsoptionalProvides collection interfaces like IIterable, IVector, and IMap.
winrt-windows.storageoptionalProvides access to file system and storage APIs, often used in conjunction with streams.
winrt-windows.systemoptionalProvides access to system-level APIs.