Skip micropip load for apps with pyproject.toml#6300
Open
FeodorFitsner wants to merge 2 commits intomainfrom
Open
Skip micropip load for apps with pyproject.toml#6300FeodorFitsner wants to merge 2 commits intomainfrom
FeodorFitsner wants to merge 2 commits intomainfrom
Conversation
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.
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.
Deploying flet-examples with
|
| Latest commit: |
cecd17f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://70894229.flet-examples.pages.dev |
| Branch Preview URL: | https://skip-micropip-load.flet-examples.pages.dev |
Deploying flet-docs with
|
| Latest commit: |
cecd17f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6097a012.flet-docs.pages.dev |
| Branch Preview URL: | https://skip-micropip-load.flet-docs.pages.dev |
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.
Close #6259
Summary by Sourcery
Conditionally load the micropip package in the Pyodide worker only when Python dependencies need to be installed, avoiding unnecessary loading for apps that do not require micropip.
Enhancements: