Skip to content

v0.82.3.dev7863

@FeodorFitsner FeodorFitsner tagged this 16 Mar 20:39
* Load micropip lazily and guard installs

Avoid loading micropip unconditionally at startup. Introduce an async ensure_micropip() helper that tries to import micropip and falls back to pyodide_js.loadPackage('micropip') if it's not present. Call ensure_micropip() and import micropip only when requirements.txt exists or when dependencies are provided in arguments. Also skip micropip.install when requirements.txt contains no entries. These changes reduce startup work and handle environments where micropip isn't preloaded.

* Check and load micropip only when needed

Replace ensure_micropip with micropip_imported() which returns a boolean indicating whether micropip is already importable. If micropip is missing, the code now loads the micropip package via pyodide_js.loadPackage('micropip') and then conditionally imports micropip in the requirements and dependencies handling paths. This avoids always invoking the package loader unconditionally.

* Ensure micropip is loaded and filter requirements

Replace the micropip presence check with ensure_micropip() that loads the micropip package when missing and returns the imported module. Improve requirements.txt parsing to skip blank lines and comments, and only initialize micropip when actually needed (both for requirements.txt and py_args dependencies) before calling micropip.install.

* Use artifact name to detect zip archives

Replace archive_path.endswith('.zip') with artifact.endswith('.zip') when extracting the Flet client. archive_path can include a random suffix from __download_flet_client, causing incorrect format detection; using the artifact name ensures .zip archives are recognized correctly. Added a clarifying comment.
Assets 2
Loading