I'm trying to run PyScript in a webpage, where I intended it to run and produce the output of a python code to a div element. I've succeeded in doing this. However I noticed it always produces the splashscreen "Downloading Pyodide Python Startup" every time I refreshed the webpage. It's taking significantly longer wait time for this.
Is there a way to in a way cache the Pyodide installation and make the loading times significantly faster? I'm deploying this webpage to Github Pages here https://reza-nugraha32.github.io/geophysics-wiki/ .
I'm aware that it's not better to hide the splash screen entirely. Is there also a way to start this splash screen in a div container or importing the PyScript only when a "Run" button is clicked? For instance, Educative.io here made it so it display "Loading" only when the "Run" button is clicked.
I've tried deleting the defer
tag from the PyScript import script but it gave me errors.
Sorry, Reza, but that's just the way it works. The whole environment has to be downloaded before any code runs. Pyscript Next (2023.11.1) may improve your situation, especially if you can use Micropython. Check out Jeff Glass's blog - https://jeff.glass/post/whats-new-pyscript-2023-11-1/.