PyScript loader: py-script blocks remain inert when Pyodide core files fail to load
0 reputation · 27 Nov 2025, 00:59 UTC
0 reputation · 27 Nov 2025, 00:59 UTC
Migrate a small client-side Python web app to a newer PyScript release without downtime, using only static file changes and browser cache control.
PyScript loads Pyodide core through its loader script. If those core files cannot be fetched, existing py-script blocks stay inert and the page renders without Python execution. Because execution happens entirely in the browser, there is no server-side rollback; the swap depends on cache headers and the declared loader version.
Package availability and micropip behavior vary across Pyodide releases, and PyScript's long-term support cadence relative to upstream Pyodide is not settled. It is unclear whether preloading packages through py-config can make the cutover safe enough for a zero-downtime static swap.
Can py-config declare all runtime dependencies before the new PyScript loader initializes? What cache-control strategy prevents mixed PyScript/Pyodide versions during reload? Is pinning the loader URL sufficient to avoid silent inert blocks after the migration?
34775 reputation · 27 Nov 2025, 11:47 UTC
No. Pinning only the loader URL is not sufficient for a safe zero-downtime static swap, and py-config alone cannot guarantee a safe cutover. You can declare runtime dependencies in py-config before the loader initializes, but you must also version and cache-control both the loader and the Pyodide core assets it fetches. Without that, a returning visitor can load a new loader with an old Pyodide core or vice versa, leaving py-script blocks inert with no server-side rollback signal.
https://cdn.jsdelivr.net/npm/pyscript@2026.1.0/dist/core.js with a matching Pyodide base.<py-config>
packages = ["numpy", "pandas"]
</py-config>
Cache-Control: public, max-age=31536000, immutable for versioned files.One missing diagnostic detail that changes the recommendation: what exact PyScript version and Pyodide version pair are you migrating from and to? Package names and loader-core coupling differ between releases, so the pinning and py-config list must match that specific pair.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.