Closed jakobaxelsson closed 9 months ago
Implementation steps:
It turns out that the current stable version of pyscript does not support json config files, it is planned for the next release. Here is an alternative plan:
A problem when generating the packages is that there is currently also the copy of domed in this directory. A solution that packages sossim also requires to finally remove domed from this repo.
The repository has been refactored as follows:
To make the app html file completely generic, the title element from the head has been removed. The intention was to set this dynamically in the user interface, but there does not seem to be an easy and obvious way to do this in domed?
Issue with title now resolved.
Returning to the issue with pyodide vs. pyscript. Given that the pyscript html file for the app is now completely generic, a similar generic file can be made for pyodide. It only needs to get information about what packages to load, otherwise all the rest can be hardcoded as in the case for pyscript.
To get the package information, the pyconfig.toml
file needs to be parsed, at least rudimentary.
The file app/sossim_pyodide.html
is now working. It does the same thing as sossim.html
but without using pyscript. However, the startup time is almost the same, so it does not provide much benefit.
Currently, it takes quite long to load SoSSim in the browser. Some options to investigate:
The potential drawbacks of these solutions are:
fetch(url).then(r => r.text()).then(t => some_expression_to_process_the_text(t))
.pyconfig.toml
intopyconfig.json
. This would make the file directly readable from JS, and then the same file could be used independently if it is through pyscript or pyodide. UPDATE: It is only the next version of Pyscript that supports json files, so this does not work right now.Making SoSSim into a package has other benefits. At some point, it will probably be desirable to put an outer loop that calls the simulator for a number of different scenarios and collects statistics, e.g. to evaluate how well a proposed SoS mechanism performs in different situations.