docs: Add Subinterpreters cookbook recipe (Python 3.14 in-process multi-core parallelism) - #6782
Open
ndonkoHenri wants to merge 4 commits into
Open
docs: Add Subinterpreters cookbook recipe (Python 3.14 in-process multi-core parallelism)#6782ndonkoHenri wants to merge 4 commits into
ndonkoHenri wants to merge 4 commits into
Conversation
Deploying flet-website-v2 with
|
| Latest commit: |
99b59c2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9f584fe7.flet-website-v2.pages.dev |
| Branch Preview URL: | https://subinterpreters.flet-website-v2.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.
Adds a new cookbook recipe for using Python 3.14 subinterpreters (
concurrent.interpretersandInterpreterPoolExecutor) in Flet apps for true multi-core CPU parallelism inside a single process — the in-process, mobile-capable counterpart to the Multiprocessing recipe (which can't spawn child processes on iOS/Android).Verified on every Flet platform
The behaviour was validated on-device with a playground test matrix (two Flet apps exercising each worker shape from
main.pyand from a module, viainterp.calland the pool). All six platforms agree exactly:Key findings baked into the recipe:
main()only work if fully stateless, so the rule is "define workers at module top level" (same as multiprocessing).NameError) — and it fails from a module too, so it isn't a main-vs-module issue.Notes
serious_python≥ 4.3.6 (the per-interpreter import-finder fix, fix(android): make PEP 734 subinterpreters work (concurrent.interpreters/InterpreterPoolExecutor) serious-python#239), which is already bundled by Flet 0.86.3+ (0.86.5 →serious_python4.5.1). No build-template change is needed here.requires-python = ">=3.14"orflet build --python-version 3.14).Summary by Sourcery
Document Python 3.14 subinterpreters as a mobile-capable alternative for CPU-bound parallelism in Flet applications.
Enhancements:
Documentation: