fix(itkwasm): support wasmtime 48 - #1588
Closed
vboussot wants to merge 1 commit into
Closed
Conversation
wasmtime 48.0.0 removes `DirPerms` and `FilePerms` and replaces the two `WasiConfig.preopen_dir` permission arguments with a single `fs_mutable` boolean, simplifying wasi-filesystem permissions to read-write or read-only (bytecodealliance/wasmtime#14010). Importing either enum raises ImportError, and because `pipeline` imports them at module scope, `import itkwasm` fails outright on wasmtime >= 48. Read-write is the default on both sides of that change: `preopen_dir` defaults to `dir_perms=DirPerms.READ_WRITE, file_perms=FilePerms.READ_WRITE` from 28.0.0 through 47.0.1, and to `fs_mutable=True` from 48.0.0. Passing neither argument therefore keeps the same permissions across the whole declared range and needs no version branching. `preopen_dir` is reached only by pipelines carrying a TextFile or BinaryFile interface, so verification uses one: on wasmtime 28.0.0, 47.0.1 and 48.0.0, `input-output-files-test.wasi.wasm` reads a text and a binary input from one preopened directory, writes both outputs into a second, and the bytes written to disk match the expected contents.
vboussot
force-pushed
the
fix/wasmtime-48-preopen-dir
branch
from
August 20, 2026 21:44
7dbc2b8 to
83e59ae
Compare
Member
|
@vboussot thank you for this!! I dug into a fix before I found your PR. |
Member
|
I pushed the same fix to itkwasm 1.0b201 on PyPI, PR incoming. |
Member
|
redundant |
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.
import itkwasmfails on wasmtime >= 48.0.0, released 2026-08-20:pipeline.pyimportsDirPermsandFilePermsat module scope, so the failure hits at import time, before anything runs. Any test suite that imports itkwasm from aconftest.pydies during collection.What changed upstream
wasmtime 48.0.0 simplified wasi-filesystem permissions to read-write or read-only per directory (bytecodealliance/wasmtime#14010, listed under Changed in the 48.0.0 notes). In the Python bindings (bytecodealliance/wasmtime-py@2ed8d10) both enums are deleted and the signature becomes:
The fix
Read-write is the default on both sides of that change, so passing neither permission argument keeps the current behaviour across the whole declared
wasmtime >= 28.0.0range. No version branching, notry/except, no floor bump.Signature checked at every relevant tag:
preopen_dirsignaturedir_perms=DirPerms.READ_WRITE, file_perms=FilePerms.READ_WRITEfs_mutable: bool = TrueVerification
Pipeline.runbuildspreopen_directoriesfromTextFileandBinaryFileinterfaces only, so a pipeline carrying images or streams leaves the list empty and never enters the changed loop. Verification therefore drives the same wasm module and inputs astest/test_pipeline.py::test_pipeline_input_output_files:input-output-files-test.wasi.wasmwith a text and a binary input read from one preopened directory, and both outputs written into a second, asserting the bytes that land on disk.RunInstance.__init__was instrumented for those runs to confirm the two directories reachpreopen_dirrather than assuming it.DirPermsandFilePermsappear nowhere else in the repository.One coverage note, outside this fix
No CI job exercises
test_pipeline_input_output_files: thepython-wasm.ymlmatrix covers the derived packages (downsample,image-io, ...), notpackages/core/python/itkwasm, and those packages' pixi environments resolveitkwasmfrom released PyPI wheels rather than from the local tree. Everypixi.lockin the repository also pins wasmtime below 48. So this change, and thepreopen_dircall in general, is not covered by the current matrix on any wasmtime version.