Skip to content

refactor(build): rename web build platform from Pyodide to Emscripten#6492

Merged
FeodorFitsner merged 6 commits into
mainfrom
pyodide-to-emscripten
May 12, 2026
Merged

refactor(build): rename web build platform from Pyodide to Emscripten#6492
FeodorFitsner merged 6 commits into
mainfrom
pyodide-to-emscripten

Conversation

@FeodorFitsner
Copy link
Copy Markdown
Contributor

@FeodorFitsner FeodorFitsner commented May 12, 2026

Summary

  • Renames the web-build platform identifier from Pyodide to Emscripten so it matches what platform.system() actually returns inside a Pyodide runtime.
  • Updates the PEP 508 markers on flet's oauthlib/httpx deps from platform_system != 'Pyodide' to platform_system != 'Emscripten', so they now work consistently in both build-time pip resolution (via serious_python's sitecustomize) and direct in-browser installs via micropip.
  • Bumps serious_python to 1.0.0 in the flet build template — required for the renamed --platform Emscripten argument value. See flet-dev/serious-python#201.

Why

The previous 'Pyodide' value never matched real-world platform.system() (which returns 'Emscripten' under Pyodide). The build-time path masked the problem by monkey-patching platform.system() to return 'Pyodide' via serious_python's injected sitecustomize.py. But anyone installing flet directly via micropip in a Pyodide REPL hit the real value and the markers were silently ineffective — oauthlib and httpx got pulled in unnecessarily.

Test plan

  • flet build web with the new template builds successfully and the dart invocation logs show --platform Emscripten.
  • Packaged site-packages does not contain oauthlib or httpx.
  • App boots in the browser without missing-import errors.
  • micropip.install("flet") inside a Pyodide REPL also skips oauthlib/httpx.
  • flet build apk / flet build macos / flet build linux still build (no code path touched).

Summary by Sourcery

Rename the web build platform identifier from Pyodide to Emscripten and align dependency markers and templates with the new platform name.

Bug Fixes:

  • Ensure oauthlib and httpx dependencies are correctly excluded when running under the Emscripten (Pyodide) platform via accurate PEP 508 markers.

Enhancements:

  • Update web build configuration to use the Emscripten platform identifier consistently across packaging and Flutter build steps.
  • Bump the serious_python dependency in the build template to 1.0.0 to support the renamed Emscripten platform argument.

Build:

  • Adjust web build logic so site-packages handling and wasm flags are based on the Emscripten platform identifier instead of Pyodide.

…cripten`

Aligns the value with `platform.system()` inside Pyodide, so PEP 508 markers
on `flet`'s deps (`oauthlib`, `httpx`) work both via `flet build web` (through
serious_python's sitecustomize) and when `flet` is installed directly via
micropip in a Pyodide runtime. Requires the matching rename in serious_python.
Required for the `Pyodide` → `Emscripten` platform-argument rename to take
effect on `flet build` runs.
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 12, 2026

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 67b163c
Status: ✅  Deploy successful!
Preview URL: https://7326f86d.flet-website-v2.pages.dev
Branch Preview URL: https://pyodide-to-emscripten.flet-website-v2.pages.dev

View logs

@FeodorFitsner FeodorFitsner requested a review from ndonkoHenri May 12, 2026 03:49
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 12, 2026

Deploying flet-examples with  Cloudflare Pages  Cloudflare Pages

Latest commit: 67b163c
Status: ✅  Deploy successful!
Preview URL: https://25868440.flet-examples.pages.dev
Branch Preview URL: https://pyodide-to-emscripten.flet-examples.pages.dev

View logs

…ts reach the host Console

msgpack was only ever imported if the user's deps pulled it in (typically
via flet). Apps with no flet dependency — or no pyproject.toml at all —
left the python_output bridge unregistered, and their prints fell through
to the browser dev console silently. Load msgpack from Pyodide's prebuilt
repodata when it isn't already importable; the bridge install is now
unconditional.
Integration test packages/flet/integration_tests/examples/apps/test_use_dialog.py imports `main` from each example expecting a `main(page)` callable. The wrapper was inadvertently removed in #6489, breaking pytest collection.
@FeodorFitsner FeodorFitsner merged commit 88ac763 into main May 12, 2026
57 of 58 checks passed
@FeodorFitsner FeodorFitsner deleted the pyodide-to-emscripten branch May 12, 2026 17:46
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