Skip to content

Load any Pyodide package on first import - #50

Merged
davidackerman merged 2 commits into
mainfrom
feature/lazy-imports
Oct 22, 2026
Merged

davidackerman merged 2 commits into
mainfrom
feature/lazy-imports

Conversation

@davidackerman

Copy link
Copy Markdown
Member

The browser engine's Pyodide workers now load any package Pyodide ships the first time their Python imports it. Before, only scipy and scikit-image loaded this way.

  • web/src/pyworker.ts. On a failed import, the worker looks the module up in Pyodide's lockfile (py.lockfile, which lists the modules each package provides) and loads that package. This replaces the LAZY table. There is no new option, so a page imports inside its function and lists nothing.
    • In 0.28.3, PIL maps to Pillow, scipy to scipy and skimage to scikit-image.
    • A module Pyodide doesn't ship fails as before.
  • Why. cellmap-flow asked for Pillow, to drop its numpy copy of Pillow's resampling. That copy already drifts from Pillow 13.
  • Docs. design.md (another page on the engine) and the CHANGELOG, under a new Unreleased heading. tests/test_docs.py's version check now skips that heading, and contributing.md's release steps name it.

…n imports it, found by its module in Pyodide's lockfile (py.lockfile), instead of the two in LAZY (scipy, scikit-image): a page's own modules import Pillow (or anything else of Pyodide's) inside their functions and list nothing, as cellmap-flow asked; design.md and the CHANGELOG say so, under a new Unreleased heading, which test_docs' version check now skips and contributing.md's release steps name
…yodide ships but not listed loads when first imported
@davidackerman
davidackerman marked this pull request as ready for review October 22, 2026 03:17
@davidackerman
davidackerman merged commit a7eb44e into main Oct 22, 2026
2 checks passed
@davidackerman
davidackerman deleted the feature/lazy-imports branch October 22, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant