Skip to content

wasi-python 0.1.3

Choose a tag to compare

@github-actions github-actions released this 04 Nov 23:49
· 32 commits to dev since this release
Immutable release. Only release title and notes can be modified.

0.1.3 checkpoints and forks a live session, returns a cell's value and displays typed, with matplotlib figures as PNGs, and streams a guest's output while it runs. It adds python-docx, python-pptx, pdfplumber, xarray, plotly, drawsvg, SVG to PNG through cairo, JPEG in Pillow, and zstd, and a plain start costs less. You may need to act on seven changes: SnapshotFailed.completed may be None, argv refuses -Xhost-results, CPython, numpy and pandas move to 3.15.2, 2.5.4 and 3.1.0, three pure packages move, a snapshot saved with 0.1.2 must be made again, and hashing a deeply nested tuple raises sooner. It is published on GitHub and on PyPI.

New

  • Checkpoint a live session, and fork it. Session.checkpoint() keeps a session's state after its turns as a Snapshot; any number of sessions and calls start from it, each from its own copy, and the session goes on. A checkpoint holds every byte the session read. Checkpoint a session, and fork it
  • Other engines can checkpoint a session too. The snapshot binary exports checkpoint, called with 1 before the host reads a session's memory and with 0 after; an instance given that memory resumes as a fresh start at its first run or turn. Embed from other languages
  • A cell's value and displays come back typed. With results=True, run, run_async and Session return a turn's or a -c program's last expression as Completed.value, not printed, and what the program passes to display() as Completed.displays, each a Display of MIME types; printed bytes never forge one. Read a cell's value and displays
  • matplotlib's figures come back as PNGs. With figures=True beside results=True, plt.show() and a figure a cell leaves open become PNG displays, with no file and no writable grant for the image. Add figures=True
  • Other hosts can take displays too. The tool protocol gains the display operation, used when the host passes -Xhost-results as the program's first argument; the guest falls back to printing against a host that does not serve it. Tool protocol
  • See a guest's output while it runs. run, run_async and a session's turns take on_output, called with each chunk of stdout and stderr as it arrives; OutputFeed iterates them from async code. On the command line, --stream prints a JSON line per chunk. Read output while the guest runs
  • Keep the end of a long output. output_keep="tail" keeps a stream's last bytes past output_bytes, after a line counting what was cut, so the traceback at the end is kept; --output-keep tail on the command line. Keep the end of a long output
  • Answer a turn's input(). Session.run and Session.run_async take stdin, that turn's standard input, which sys.stdin and input() read. Give a turn its standard input
  • Word and PowerPoint files. python-docx 1.2.0 and python-pptx 1.0.2 are in the zip. Start a document or a deck from the default template, or open one; add text, tables, pictures, charts and notes; save it to a granted folder or to memory. fit_text() needs FreeType, which the set lacks. Packages
  • Tables and text from PDF files. pdfplumber 0.11.10 with pdfminer.six 20260107 is in the zip: each page's text, its words with their positions, its ruling lines and extract_tables(), and files encrypted with RC4. AES needs cryptography and page images need pypdfium2, which the set does not carry; each raises ModuleNotFoundError naming it. Packages
  • Labelled arrays. xarray 2026.9.0 is in the zip: named dimensions, alignment on labels, groupby, rolling, resample, interpolation through scipy, pandas round trips, the HTML view, and netCDF3 files through scipy. Its other file engines and its tutorial data are not carried. Packages
  • Interactive plotly figures. plotly 7.1.0 is in the zip: graph objects and plotly express, its datasets, JSON, and HTML pages that carry plotly.js or load it from plotly's CDN. Static images need kaleido, which cannot run here, and FigureWidget needs a notebook; both raise. Packages
  • Zstandard compression works. compression.zstd is built in over libzstd 1.5.7, so tarfile's zst modes, zipfile's ZIP_ZSTANDARD and shutil's zstdtar format work, and write native Python's bytes. It runs on one thread, and frames from before zstd 0.8 do not decode. Packages
  • pandas reads and writes .zst files. compression="zstd" and a .zst suffix now use the standard library's compression.zstd, since the set has no python-zstandard. level is honoured when writing; any other option raises TypeError. Packages
  • Pillow reads and writes JPEG. Pillow is built with libjpeg-turbo 3.2.0 beside zlib, so Image.open of a photo, save(..., "JPEG") and matplotlib's savefig(format="jpg") work, with native Pillow's bytes and pixels. WebP, AVIF, JPEG 2000 and TIFF's compressions still raise an error. Packages
  • List the packages an agent can import. wasi_python.packages() returns each Python package in the runtime with its version and import names, without starting a guest; wasi-python packages prints them, or one JSON line with --json. Packages
  • Vector drawings and animations as SVG and HTML. drawsvg 2.4.2 is in the zip: shapes, paths, text on a path, gradients, markers, clip paths and masks, SMIL animations with playback controls, and frame callbacks, saved as SVG or HTML. Its PNG, GIF and video output, drawsvg.color and Google fonts raise by name. Packages
  • SVG to PNG and PDF, drawn by cairo. cairo 1.18.6 is built in, with CairoSVG 2.9.1 in the zip: cairosvg.svg2png and svg2pdf turn any SVG into a PNG or a PDF with native cairo's pixels, and text is drawn in matplotlib's DejaVu fonts. PostScript output is not available. Packages
  • cairocffi, a 2D drawing API. cairocffi 1.7.1 draws paths, gradients and text onto image, PDF and SVG surfaces, and reads and writes PNG. At most 128 stream surfaces are alive at once. Limitations
  • drawsvg drawings as PNG and GIF. drawsvg's rasterize(), save_png and save_gif now work, through CairoSVG and imageio; video (save_mp4) still needs ffmpeg, which the guest cannot run. Limitations
  • Animated GIFs with imageio. imageio 2.38.1 reads and writes images through Pillow, animated GIFs included. Its video plugins need programs or compiled packages the set does not carry, and raise when used. Packages

Faster

  • A plain start reads only the packages it uses. An empty program on the plain binary now runs in 135 million instructions, from 284 million, and on the snapshot in 42 million, from 55 million. A package added to the runtime costs a start almost nothing until a program imports it. How it works
  • A call ends on less fuel. Python still finalizes everything as CPython does, but no longer returns memory to an instance about to be discarded: a bare snapshot call costs 35 million instructions, not 42 million. Every allocation now checks one flag, so a call that allocates much and holds little costs up to 0.4% more. Fuel

Security

  • tarfile's tar filter refuses a link to its own destination. CPython 3.15.2 makes tarfile.tar_filter reject a link member whose path resolves to the destination folder itself, as data_filter already did (gh-160097). Security model
  • http.cookiejar ignores cookies with a negative version. CPython 3.15.2's DefaultCookiePolicy no longer accepts or returns them without checking their domain against the request's host (gh-160300). Security model
  • The XML parser is libexpat 2.9.0. CPython 3.15.1 updates the libexpat that xml.etree, xml.dom.minidom and pyexpat parse with (gh-157953). Security model
  • zlib 1.3.2's hardening is inside. zlib 1.3.2, from 1.3.1, checks for negative lengths in crc32_combine and for NULL pointers, zeroes its inflate state when it allocates it, and copies only initialized state in inflateCopy and deflateCopy. zlib, gzip and zipfile use it. Security model
  • pypdf's limits on hostile PDFs are inside. pypdf 6.21.4, from 6.21.1, bounds cross-reference tables and copied page attributes, detects a missing end of file and a cloning loop, and uses the validated page count after decryption. Packages
  • A display frame is checked before the host parses it. With results=True, a frame holding more values than a display needs, or more text than output_bytes could keep, is refused unparsed, so a display frame costs the host at most about 36 times output_bytes, or nine times the tool request cap when tools make that more. Security model

Fixed

  • importlib.metadata.packages_distributions() answers in the guest. Each package now carries its top_level.txt, so the guest maps sklearn to scikit-learn. Limitations

Upgrading

  • SnapshotFailed.completed may be None when no code ran. A checkpoint refused for an open file raises SnapshotFailed with the reason "open file" and no Completed; code that reads e.completed.exit_code checks for None first. Results and errors
  • -Xhost-results is the runner's argument. An argv that passes -Xhost-results or -Xhost-results=figures before the program's -c, -m, script or - now raises ValueError; pass results= instead. After the program's target it is the program's own, as before. Read a cell's value and displays
  • CPython 3.15.2 and numpy 2.5.4 inside. Bug-fix releases, from 3.15.0 and 2.5.2. Packages
  • pandas 3.1.0 inside. A new minor release, from 3.0.6; read pandas' 3.1.0 notes for code that relies on what it changed. Packages
  • soupsieve, wrapt and tzdata move to their newest fixes. soupsieve 3.0.4, wrapt 2.5.2 and tzdata 2026.6, from 3.0.3, 2.5.1 and 2026.5. Packages
  • Saved snapshots are made again. The binary and the zip change, so a Snapshot saved with 0.1.2 raises SnapshotMismatch. Make it again after you upgrade. Snapshots
  • Hashing a deeply nested tuple raises sooner. CPython 3.15.2 checks the C stack while it hashes a tuple, so a tuple nested more than a few thousand levels deep raises RecursionError, as repr and == already did. 0.1.2 hashed about 40,000 levels, then ended the call with a trap. Limitations

For contributors

  • A merged change's worktree and branch are cleared. Once a pull request is squash-merged into dev and a green run after the merge covers it, its worktree and local branch are removed; GitHub deletes the remote branch at the merge, and the pull request's head stays fetchable by its number. Review and landing
  • The wheel's size check allows 256 MiB. The check that the wheel fits PyPI now reads 256 MiB, the file limit asked of PyPI, in place of PyPI's default 100 MiB, so packages past the default can land; a release with a larger wheel is not uploaded to PyPI until PyPI grants it. The release process
  • A tag's run publishes what the release pull request judged. The tag's run rebuilds the set from the pins on three hosts, checks that its bytes and its commit are the ones the release pull request judged and recorded, installs the wheel on three systems, signs and publishes; it runs no test again. What the release workflow does
  • The published set is built on arm64 Linux. The release's artifact set and wheel are compiled on arm64 Linux instead of arm64 macOS; x86_64 Linux and arm64 macOS rebuild them from the pins and must give the same bytes before anything is cached, signed or published. The same bytes from any build host
  • A pull request's run ends sooner. The tests start beside lint instead of after it, macOS runs on a pull request only when the platform module or the engine's pin changed, the longest test shards are split, and the review file has its own check, review. What a pull request runs
  • The release run packs its slow tests into fewer legs. The release tier's shards are packed by measured minutes, about twelve a leg, and the build shard runs in the x86_64 rebuild, so a merge's run no longer waits for a compile. What the release workflow does
  • sympy's slowest test no longer holds a release leg. test_uniform_P, which upstream expects to fail, ran past the release job's 30 minutes under CPython 3.15.2; it now runs to a small fuel cap and is recorded as a known gap, so every release leg is packed to about twelve minutes. What the release workflow does
  • A red run on dev no longer stops other merges. A red run after a merge opens an issue naming its red legs, the merged change's author fixes it forward the same day or reverts it, and other pull requests keep merging; a pull request no longer needs to be up to date with dev. Review and landing
  • A review takes one round. A round's fixes are one commit, and a Low finding answered in writing needs no second signing. A release's notes are read in its review against the threat model, which starts beside the release's last changes. Release process
  • A merge is recorded once its tests pass. After a merge, a growth, a fall in passes, a test moved between tiers or a changed test file with no reason no longer stops the record; the record names it, and the release waits until each has its reason, in the news file or the release ledger. After a merge
  • Two carried patches read the templates from the zip. recipes/patches/python_docx-1.2.0/0001-templates-read-as-package-resources.patch and recipes/patches/python_pptx-1.0.2/0001-templates-read-as-package-resources.patch read each default template through the package's loader, so Document() and Presentation() work from a zip. Carrying a patch
  • The build's wasmtime is the runner's line. The snapshot is made by wasmtime 50.0.1, not 49.0.3. Building
  • The carried patches follow their pins. recipes/patches/numpy-2.5.4/0001-npy-files-without-dup.patch, recipes/patches/numpy-2.5.4/0002-callback-signatures.patch and recipes/patches/pypdf-6.21.4/0001-tests-import-ssl-where-it-is-used.patch are re-made against their new tarballs, each with the same changed lines. Carrying a patch
  • pandas' carried patch follows its pin. recipes/patches/pandas-3.1.0/0001-styler-templates-from-a-zip.patch is re-made against pandas 3.1.0's tarball, with the same changed lines. Carrying a patch
  • pandas' C++20 builds for the guest by its cross file. xsimd's emulated architecture declares the SIMD API pandas' scalar path names, and pandas' fast_float takes a namespace of its own beside scipy's older copy. Adding a package
  • A carried patch lets pdfminer.six start without cryptography. recipes/patches/pdfminer_six-20260107/0001-import-cryptography-where-aes-runs.patch moves pdfminer's two cryptography imports into the one helper its AES paths call, so plain and RC4 files read without it. Carrying a patch
  • A carried patch lets plotly read its data from the zip. recipes/patches/plotly-7.1.0/0001-data-as-package-data.patch reads the validators' table and the datasets through the package's loader, as plotly already reads plotly.js. Carrying a patch
  • The platform code is split by host family. The POSIX, Linux and macOS hosts now have a file of their own beside the Windows one, and the interface and the choice stay where they were. Nothing an embedder sees changes. Your first change
  • A carried patch gives pandas the standard library's zstd. recipes/patches/pandas-3.1.0/0002-zstd-from-the-standard-library.patch opens a compression.zstd.ZstdFile in get_handle when python-zstandard does not import, and refuses any option but level on write. Carrying a patch
  • libjpeg-turbo is compiled without CMake. The plot libraries' step compiles libjpeg's 101 files from the list in its CMakeLists.txt, with no SIMD and the libjpeg v6b API, and its three configured headers are recipe files under recipes/libjpeg-turbo/, held to their templates. Building
  • Each package staged as a folder names its import names. The zip step's --metadata takes <PKG-INFO>=<name>,<name>, and the build stops on a top-level name no package owns or two packages own. Adding a package
  • Two tqdm tests that trade causes no longer fail a run. Which of the two meets a leftover asyncio event loop depends on the build's memory layout; they now share one failure class that names them, so either order passes, and each must still fail for a known cause. Two tiers of tests
  • A package that ships no tests is checked by its golden jobs. tests/upstream/packages.toml gains the kind none: a reason saying where the absence of tests was read, and checked_by, golden jobs that must import the package. It is refused when the package has a suite file. Adding a package
  • A carried patch lets CairoSVG import from the zip. recipes/patches/cairosvg-2.9.1/0001-read-version-through-the-package-loader.patch reads CairoSVG's VERSION file through the package's loader instead of a path made from __file__, which names no file inside the zip. Carrying a patch
  • cairocffi runs on a stand-in for its ffi module. The bindings are written in cffi's API mode at build time and linked in; recipes/cairocffi_ffi_stand_in.py replaces the module that would load cairo at run time, and step 56 stops if the pinned cairocffi grows past it. Building
  • The judge's rules for the new families. A test-source smoke group may measure 110 G and all of them 1.2 T (tinycss2's one file is 105.9 G); a family may stage test-side stand-ins (test_stand_ins) that name no module the zip carries, an edit to one a judge change; the zip may carry cairosvg/*.py beside their bytecode. Adding a package
  • Open pull requests no longer conflict over the release's claims. The release ledger is now one file per pull request, named after its news file, instead of one file every pull request appended to; the check refuses a reason written into another change's file. The release process
  • A tag no longer signs a wheel PyPI would refuse. When a tag uploads to PyPI, the release workflow compares the wheel with the limit PyPI has granted (the repository variable PYPI_FILE_LIMIT_GRANTED, or 100 MiB) and stops before anything is signed or published. A refusal for size is re-run once PyPI raises the limit. The release process

Verify a download (gh logged in; see Verify a download):

gh attestation verify <asset> --repo ClayGendron/wasi-python \
  --signer-workflow ClayGendron/wasi-python/.github/workflows/release.yml@refs/tags/v0.1.3 \
  --source-ref refs/tags/v0.1.3 --deny-self-hosted-runners