-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A website for example models? #139
Comments
I think pycafe is suggested as one of the options. |
I tried to use Solara to build something like https://solara.dev/documentation/examples for Mesa examples. With some kind help from @iisakkirotko in here and Solara's souce code for the page, I was able to get this: Source code is at my fork: https://github.com/wang-boyu/mesa-examples/tree/mesa-website. The command used is simply My takeaways so far:
Overall I think this will be great for showcasing Mesa examples and encouraging coummunity contributions of their models. Thoughts? @projectmesa/maintainers |
This is really interesting!
Could we deploy with GitHub pages? Or do we need interactive servers on the back-end? |
Would https://py.cafe not work, why would you need a server? |
@maartenbreddels What's super useful for us of PyCafe is that you have the source code directly side-by-side to the visualisation. That's what NetLogo also does and really powerful to be able to directly interact with it. How would such a workflow work? Are there any examples, especially on how to setup and deploy? Basically, for us, I image we have one tab for each example in |
I'm not exactly sure what you need. But you can imagine embedding pycafe in an iframe. We support special embedding of apps, which is something we use for this mkdocs plugin: We also started documenting how we can create these links: https://py.cafe/docs/api#snippet-links I'm not sure if this helps. If not, let me know in more details what you'd like to build, and we can see how PyCafe can help. |
Yes, py.cafe can be an excellent solution! I just tested it. Here is the Schelling example I only uploaded the files from examples/basic/schelling, adjusted the requirements.txt file to include mesa and it worked! So I guess the only thing we would like to have is the ability to automatically think our code with the code on py.cafe. Is there already an api access? So we could just push those files as part of our CI or something like that? |
I got four of the basic examples working, based on the simulatingrisk/app.py from @rlskoeser.
So now:
|
Ha, I was a few seconds faster, but your solution is already complete 😮 Regarding conway, py.cafe also supports streamlit, but I guess not inside solara? (independent on py.cafe). Any thoughts @maartenbreddels ? |
I wonder if it makes sense to include the 4 apps into 1 into PyCafe, or do split it in 4 PyCafe projects or snippets. The downside is that the code lives on PyCafe, and is not linked to GitHub. Another advantage of having it per project, is that one of your projects could be streamlit based. Snippet urls, like described on https://py.cafe/docs/api#snippet-links can be programmatically put together, and be generated from a GitHub Action, but they are do not support screenshots/galleries. You can put these links together on a static html file with your own generated gallery, but that is more work. To explicitly answer the last question: you cannot run streamlit in solara, but indeed it runs on PyCafe |
@maartenbreddels Thanks! @Corvince feel free to to continue on my project. |
Thanks for the response. pycafe would absolutely work, especially something like the gallery metioned above: https://py.cafe/panel-org/. My concern was that -
That said, it's definitely a great idea to have a gallary of mesa models on pycafe, such as what @EwoutH did above. Btw I also tried to use Solara routes, but couldn't get it working for multiple levels, e.g., a path |
Given that we have moved a subset of examples back into Mesa itself, would it not be logical to start with those examples (as @EwoutH did)? This would involve 9 curated examples that are always up to date with mesa itself. Depending on how that plays out and what we learn from this, we can always see how we might expand this to mesa-examples (which should become more of a mesa-show-and-tell as discussed as part of the move of some examples back into mesa).
Nicely done. |
+1 @quaquel - I like this idea -- doing the core ones first. |
Discussed in #61
Originally posted by wang-boyu September 21, 2023
I came across with these websites in one of the classes I take this semester: isee Exchange™ and anylogic cloud. They include models from both the official team as well as the community. Models can be run from within the websites, and there are statistics showing number of runs etc. NetLogo also has its NetLogo Web (but without the statistics). I really like the run statistics as they provide a kind of feedback from users on which models are more popular.
This makes me wonder whether we can have something similar for Mesa example models. One advantage we have over Stella/AnyLogic/NetLogo is that we can rely on Google Colab to run models using Jupyter Notebooks. This would also be in line with what we have for Mesa & Mesa-Geo, where there are readthedocs sites for users and GitHub repos for developers. Similarly there could be a website for example model explorers and this GitHub repo containing all source code of the example models.
The text was updated successfully, but these errors were encountered: