Hi, is there a way to download all the pyscript dependencies to local computer and use it offline?
At this time, you cannot download the PyScript and Pyodide dependencies to a local directory. Neither support setting an origin yet. I believe that is planned for a future release.
I wrote an article on how to cache all assets required. This requires adding a few files to your PyScript application to convert it into a PWA. Then you do not need the Internet to run your application.
thanks for your answer, I downloaded your app and pressed the install button but I don’t really get it where the app was installed??? and after refreshing the page it did download the dependencies again!!! Maybe I’m missing something somewhere?
I would need more details. Which operating system? Which browser. For Widows, PWAs are by the browser and are managed installed just like any other Widows application (Add/Remove Programs).
Regarding downloads. Once you click the install button, the application must be refreshed (reloaded). The caching does not start until after the install completes. In the section for specifying assets I alluded to that. To cache all assets at install time, the files must be listed which I did not do deliberately: a) the names and number are changing often (weekly) and b) I have a part 2 that goes into more detail that I will publish soon.
Caching can be disabled in a browser. Start the debugger, go to “Application” tab, then to Cache/Cache Storage. If caching is enabled, the cached files appear there.
One item I forget to mention. Browser Cache Storage is per origin. That means you must serve a PWA from a web server. One origin cannot access the cached objects from another origin.
On your system, start the debugger and go to “Lighthouse”. That will test your browser and network for compatibility.
Another item to check in the Network tab. The network tab will show where the downloads are occurring. If you see “ServiceWorker” then the downloads came from the application cache. The key item with how I wrote the code is that if the PyScript/Pyodide source changes, the cache will be updated as the Last-Modified-Date is being handled by the service worker.