Mesa 3.0.0b0__tar.gz → 3.0.0b2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Mesa might be problematic. Click here for more details.

Files changed (207) hide show
  1. mesa-3.0.0b2/.github/pull_request_template.md +4 -0
  2. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/release.yml +3 -0
  3. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/workflows/benchmarks.yml +1 -1
  4. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/workflows/build_lint.yml +7 -3
  5. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/workflows/release.yml +2 -1
  6. {mesa-3.0.0b0 → mesa-3.0.0b2}/.gitignore +3 -0
  7. {mesa-3.0.0b0 → mesa-3.0.0b2}/CONTRIBUTING.md +18 -0
  8. {mesa-3.0.0b0 → mesa-3.0.0b2}/HISTORY.md +102 -0
  9. {mesa-3.0.0b0 → mesa-3.0.0b2}/PKG-INFO +1 -3
  10. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/BoltzmannWealth/boltzmann_wealth.py +1 -1
  11. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/Schelling/schelling.py +5 -7
  12. mesa-3.0.0b2/binder/environment.yml +14 -0
  13. {mesa-3.0.0b0 → mesa-3.0.0b2}/codecov.yaml +3 -2
  14. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/README.md +4 -5
  15. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/experimental.md +0 -10
  16. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/best-practices.md +15 -20
  17. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/conf.py +70 -1
  18. mesa-3.0.0b2/docs/example_template.txt +22 -0
  19. mesa-3.0.0b2/docs/examples.md +14 -0
  20. mesa-3.0.0b2/docs/examples_overview_template.txt +10 -0
  21. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/howto.md +39 -0
  22. mesa-3.0.0b2/docs/images/wolf_scheep.png +0 -0
  23. mesa-3.0.0b2/docs/index.md +102 -0
  24. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/migration_guide.md +25 -7
  25. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/overview.md +2 -1
  26. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/packages.md +2 -2
  27. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/MoneyModel.py +3 -3
  28. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/intro_tutorial.ipynb +663 -235
  29. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/visualization_tutorial.ipynb +146 -39
  30. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/__init__.py +2 -1
  31. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/agent.py +37 -27
  32. mesa-3.0.0b2/mesa/examples/README.md +37 -0
  33. mesa-3.0.0b2/mesa/examples/__init__.py +21 -0
  34. mesa-3.0.0b2/mesa/examples/advanced/__init__.py +0 -0
  35. mesa-3.0.0b2/mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +116 -0
  36. mesa-3.0.0b2/mesa/examples/advanced/epstein_civil_violence/Readme.md +34 -0
  37. mesa-3.0.0b2/mesa/examples/advanced/epstein_civil_violence/__init__.py +0 -0
  38. mesa-3.0.0b2/mesa/examples/advanced/epstein_civil_violence/agents.py +158 -0
  39. mesa-3.0.0b2/mesa/examples/advanced/epstein_civil_violence/app.py +72 -0
  40. mesa-3.0.0b2/mesa/examples/advanced/epstein_civil_violence/model.py +146 -0
  41. mesa-3.0.0b2/mesa/examples/advanced/pd_grid/Readme.md +43 -0
  42. mesa-3.0.0b2/mesa/examples/advanced/pd_grid/__init__.py +0 -0
  43. mesa-3.0.0b2/mesa/examples/advanced/pd_grid/agents.py +50 -0
  44. mesa-3.0.0b2/mesa/examples/advanced/pd_grid/analysis.ipynb +228 -0
  45. mesa-3.0.0b2/mesa/examples/advanced/pd_grid/app.py +50 -0
  46. mesa-3.0.0b2/mesa/examples/advanced/pd_grid/model.py +71 -0
  47. mesa-3.0.0b2/mesa/examples/advanced/sugarscape_g1mt/Readme.md +64 -0
  48. mesa-3.0.0b2/mesa/examples/advanced/sugarscape_g1mt/__init__.py +0 -0
  49. mesa-3.0.0b2/mesa/examples/advanced/sugarscape_g1mt/agents.py +344 -0
  50. mesa-3.0.0b2/mesa/examples/advanced/sugarscape_g1mt/app.py +70 -0
  51. mesa-3.0.0b2/mesa/examples/advanced/sugarscape_g1mt/model.py +180 -0
  52. mesa-3.0.0b2/mesa/examples/advanced/sugarscape_g1mt/sugar-map.txt +50 -0
  53. mesa-3.0.0b2/mesa/examples/advanced/sugarscape_g1mt/tests.py +69 -0
  54. mesa-3.0.0b2/mesa/examples/advanced/wolf_sheep/Readme.md +57 -0
  55. mesa-3.0.0b2/mesa/examples/advanced/wolf_sheep/__init__.py +0 -0
  56. mesa-3.0.0b2/mesa/examples/advanced/wolf_sheep/agents.py +102 -0
  57. mesa-3.0.0b2/mesa/examples/advanced/wolf_sheep/app.py +77 -0
  58. mesa-3.0.0b2/mesa/examples/advanced/wolf_sheep/model.py +137 -0
  59. mesa-3.0.0b2/mesa/examples/basic/__init__.py +0 -0
  60. mesa-3.0.0b2/mesa/examples/basic/boid_flockers/Readme.md +22 -0
  61. mesa-3.0.0b2/mesa/examples/basic/boid_flockers/__init__.py +0 -0
  62. mesa-3.0.0b2/mesa/examples/basic/boid_flockers/agents.py +71 -0
  63. mesa-3.0.0b2/mesa/examples/basic/boid_flockers/app.py +58 -0
  64. mesa-3.0.0b2/mesa/examples/basic/boid_flockers/model.py +69 -0
  65. mesa-3.0.0b2/mesa/examples/basic/boltzmann_wealth_model/Readme.md +56 -0
  66. mesa-3.0.0b2/mesa/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
  67. mesa-3.0.0b2/mesa/examples/basic/boltzmann_wealth_model/agents.py +31 -0
  68. mesa-3.0.0b2/mesa/examples/basic/boltzmann_wealth_model/app.py +65 -0
  69. mesa-3.0.0b2/mesa/examples/basic/boltzmann_wealth_model/model.py +43 -0
  70. mesa-3.0.0b2/mesa/examples/basic/boltzmann_wealth_model/st_app.py +115 -0
  71. mesa-3.0.0b2/mesa/examples/basic/conways_game_of_life/Readme.md +39 -0
  72. mesa-3.0.0b2/mesa/examples/basic/conways_game_of_life/__init__.py +0 -0
  73. mesa-3.0.0b2/mesa/examples/basic/conways_game_of_life/agents.py +47 -0
  74. mesa-3.0.0b2/mesa/examples/basic/conways_game_of_life/app.py +39 -0
  75. mesa-3.0.0b2/mesa/examples/basic/conways_game_of_life/model.py +31 -0
  76. mesa-3.0.0b2/mesa/examples/basic/conways_game_of_life/st_app.py +72 -0
  77. mesa-3.0.0b2/mesa/examples/basic/schelling/Readme.md +40 -0
  78. mesa-3.0.0b2/mesa/examples/basic/schelling/__init__.py +0 -0
  79. mesa-3.0.0b2/mesa/examples/basic/schelling/agents.py +26 -0
  80. mesa-3.0.0b2/mesa/examples/basic/schelling/analysis.ipynb +205 -0
  81. mesa-3.0.0b2/mesa/examples/basic/schelling/app.py +42 -0
  82. mesa-3.0.0b2/mesa/examples/basic/schelling/model.py +59 -0
  83. mesa-3.0.0b2/mesa/examples/basic/virus_on_network/Readme.md +61 -0
  84. mesa-3.0.0b2/mesa/examples/basic/virus_on_network/__init__.py +0 -0
  85. mesa-3.0.0b2/mesa/examples/basic/virus_on_network/agents.py +69 -0
  86. mesa-3.0.0b2/mesa/examples/basic/virus_on_network/app.py +136 -0
  87. mesa-3.0.0b2/mesa/examples/basic/virus_on_network/model.py +96 -0
  88. mesa-3.0.0b2/mesa/experimental/__init__.py +13 -0
  89. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/cell_space/cell.py +9 -0
  90. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/cell_space/discrete_space.py +13 -1
  91. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/cell_space/grid.py +13 -0
  92. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/cell_space/network.py +3 -0
  93. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/devs/eventlist.py +6 -0
  94. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/model.py +76 -12
  95. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/space.py +70 -5
  96. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/time.py +5 -3
  97. mesa-3.0.0b2/mesa/visualization/components/altair.py +156 -0
  98. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/visualization/components/matplotlib.py +65 -16
  99. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/visualization/solara_viz.py +13 -58
  100. {mesa-3.0.0b0 → mesa-3.0.0b2}/pyproject.toml +3 -1
  101. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_agent.py +58 -27
  102. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_cell_space.py +59 -0
  103. mesa-3.0.0b2/tests/test_examples.py +72 -0
  104. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_model.py +32 -0
  105. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_space.py +21 -0
  106. mesa-3.0.0b2/tests/test_time.py +317 -0
  107. mesa-3.0.0b0/docs/images/Mesa_Screenshot.png +0 -0
  108. mesa-3.0.0b0/docs/index.md +0 -115
  109. mesa-3.0.0b0/mesa/cookiecutter-mesa/cookiecutter.json +0 -8
  110. mesa-3.0.0b0/mesa/cookiecutter-mesa/hooks/post_gen_project.py +0 -13
  111. mesa-3.0.0b0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md +0 -4
  112. mesa-3.0.0b0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate +0 -27
  113. mesa-3.0.0b0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate +0 -11
  114. mesa-3.0.0b0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py +0 -1
  115. mesa-3.0.0b0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate +0 -60
  116. mesa-3.0.0b0/mesa/experimental/__init__.py +0 -7
  117. mesa-3.0.0b0/mesa/main.py +0 -65
  118. mesa-3.0.0b0/mesa/visualization/components/altair.py +0 -88
  119. mesa-3.0.0b0/tests/test_examples.py +0 -71
  120. mesa-3.0.0b0/tests/test_scaffold.py +0 -21
  121. {mesa-3.0.0b0 → mesa-3.0.0b2}/.codespellignore +0 -0
  122. {mesa-3.0.0b0 → mesa-3.0.0b2}/.coveragerc +0 -0
  123. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
  124. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  125. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  126. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/PULL_REQUEST_TEMPLATE/bug.md +0 -0
  127. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  128. {mesa-3.0.0b0 → mesa-3.0.0b2}/.github/dependabot.yml +0 -0
  129. {mesa-3.0.0b0 → mesa-3.0.0b2}/.pre-commit-config.yaml +0 -0
  130. {mesa-3.0.0b0 → mesa-3.0.0b2}/.readthedocs.yml +0 -0
  131. {mesa-3.0.0b0 → mesa-3.0.0b2}/CITATION.bib +0 -0
  132. {mesa-3.0.0b0 → mesa-3.0.0b2}/CODE_OF_CONDUCT.md +0 -0
  133. {mesa-3.0.0b0 → mesa-3.0.0b2}/Dockerfile +0 -0
  134. {mesa-3.0.0b0 → mesa-3.0.0b2}/LICENSE +0 -0
  135. {mesa-3.0.0b0 → mesa-3.0.0b2}/NOTICE +0 -0
  136. {mesa-3.0.0b0 → mesa-3.0.0b2}/README.md +0 -0
  137. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/BoltzmannWealth/__init__.py +0 -0
  138. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/Flocking/__init__.py +0 -0
  139. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/Flocking/flocking.py +0 -0
  140. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/Schelling/__init__.py +0 -0
  141. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/WolfSheep/__init__.py +0 -0
  142. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/WolfSheep/wolf_sheep.py +0 -0
  143. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/compare_timings.py +0 -0
  144. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/configurations.py +0 -0
  145. {mesa-3.0.0b0 → mesa-3.0.0b2}/benchmarks/global_benchmark.py +0 -0
  146. {mesa-3.0.0b0 → mesa-3.0.0b2}/docker-compose.yml +0 -0
  147. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/Makefile +0 -0
  148. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/_static/switcher.json +0 -0
  149. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/agent.md +0 -0
  150. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/api_main.md +0 -0
  151. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/batchrunner.md +0 -0
  152. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/datacollection.md +0 -0
  153. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/model.md +0 -0
  154. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/space.md +0 -0
  155. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/time.md +0 -0
  156. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/apis/visualization.md +0 -0
  157. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/mesa_logo.ico +0 -0
  158. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/mesa_logo.png +0 -0
  159. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/br_ginis.png +0 -0
  160. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/dc_endwealth.png +0 -0
  161. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/dc_gini.png +0 -0
  162. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/dc_oneagent.png +0 -0
  163. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/first_hist.png +0 -0
  164. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/multirun_hist.png +0 -0
  165. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/numpy_grid.png +0 -0
  166. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/viz_chart.png +0 -0
  167. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/viz_empty.png +0 -0
  168. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/viz_greycircles.png +0 -0
  169. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/viz_histogram.png +0 -0
  170. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/images/tutorial/viz_redcircles.png +0 -0
  171. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/make.bat +0 -0
  172. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/mesa.md +0 -0
  173. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/files/viz_chart.png +0 -0
  174. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/files/viz_empty.png +0 -0
  175. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/files/viz_greycircles.png +0 -0
  176. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/files/viz_histogram.png +0 -0
  177. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/files/viz_redcircles.png +0 -0
  178. {mesa-3.0.0b0 → mesa-3.0.0b2}/docs/tutorials/files/viz_slider.png +0 -0
  179. {mesa-3.0.0b0 → mesa-3.0.0b2}/maintenance/fetch_unlabeled_prs.py +0 -0
  180. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/batchrunner.py +0 -0
  181. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/datacollection.py +0 -0
  182. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/UserParam.py +0 -0
  183. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/cell_space/__init__.py +0 -0
  184. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/cell_space/cell_agent.py +0 -0
  185. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/cell_space/cell_collection.py +0 -0
  186. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/cell_space/voronoi.py +0 -0
  187. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/components/altair.py +0 -0
  188. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/components/matplotlib.py +0 -0
  189. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/devs/__init__.py +0 -0
  190. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/devs/examples/epstein_civil_violence.py +0 -0
  191. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/devs/examples/wolf_sheep.py +0 -0
  192. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/devs/simulator.py +0 -0
  193. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/experimental/solara_viz.py +0 -0
  194. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/visualization/UserParam.py +0 -0
  195. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/visualization/__init__.py +0 -0
  196. {mesa-3.0.0b0 → mesa-3.0.0b2}/mesa/visualization/utils.py +0 -0
  197. {mesa-3.0.0b0 → mesa-3.0.0b2}/mypy.ini +0 -0
  198. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/__init__.py +0 -0
  199. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/read_requirements.py +0 -0
  200. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_batch_run.py +0 -0
  201. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_datacollector.py +0 -0
  202. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_devs.py +0 -0
  203. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_end_to_end_viz.sh +0 -0
  204. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_grid.py +0 -0
  205. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_import_namespace.py +0 -0
  206. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_lifespan.py +0 -0
  207. {mesa-3.0.0b0 → mesa-3.0.0b2}/tests/test_solara_viz.py +0 -0
@@ -0,0 +1,4 @@
1
+ Thanks for opening a PR! Please click the `Preview` tab and select a PR template:
2
+
3
+ - [🐛 Bug fix](?expand=1&template=bug.md)
4
+ - [🛠 Feature/enhancement](?expand=1&template=feature.md)
@@ -19,6 +19,9 @@ changelog:
19
19
  - title: 🐛 Bugs fixed
20
20
  labels:
21
21
  - bug
22
+ - title: 🔍 Examples updated
23
+ labels:
24
+ - example
22
25
  - title: 📜 Documentation improvements
23
26
  labels:
24
27
  - docs
@@ -25,7 +25,7 @@ jobs:
25
25
  - name: Set up Python
26
26
  uses: actions/setup-python@v5
27
27
  with:
28
- python-version: '3.12'
28
+ python-version: '3.13'
29
29
  - name: Add project directory to PYTHONPATH
30
30
  run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV
31
31
  - name: Install dependencies
@@ -31,10 +31,10 @@ jobs:
31
31
  fail-fast: False
32
32
  matrix:
33
33
  os: [windows, ubuntu, macos]
34
- python-version: ["3.12"]
34
+ python-version: ["3.13"]
35
35
  include:
36
36
  - os: ubuntu
37
- python-version: "3.13"
37
+ python-version: "3.12"
38
38
  - os: ubuntu
39
39
  python-version: "3.11"
40
40
  - os: ubuntu
@@ -60,6 +60,9 @@ jobs:
60
60
  - if: matrix.os == 'ubuntu'
61
61
  name: Codecov
62
62
  uses: codecov/codecov-action@v4
63
+ with:
64
+ fail_ci_if_error: true
65
+ token: ${{ secrets.CODECOV_TOKEN }}
63
66
 
64
67
  examples:
65
68
  runs-on: ubuntu-latest
@@ -68,7 +71,8 @@ jobs:
68
71
  - name: Set up Python
69
72
  uses: actions/setup-python@v5
70
73
  with:
71
- python-version: "3.12"
74
+ python-version: "3.13"
75
+ allow-prereleases: true
72
76
  cache: 'pip'
73
77
  - name: Install uv
74
78
  run: pip install uv
@@ -32,7 +32,8 @@ jobs:
32
32
  - name: Set up Python
33
33
  uses: actions/setup-python@v5
34
34
  with:
35
- python-version: "3.12"
35
+ python-version: "3.13"
36
+ allow-prereleases: true
36
37
  cache: 'pip'
37
38
  - name: Install dependencies
38
39
  run: pip install -U pip hatch
@@ -1,6 +1,9 @@
1
1
  # Benchmarking
2
2
  benchmarks/**/*.pickle
3
3
 
4
+ # exampledocs
5
+ docs/examples/*.md
6
+
4
7
  # Byte-compiled / optimized / DLL files
5
8
  __pycache__/
6
9
  *.py[cod]
@@ -119,6 +119,24 @@ ruff .
119
119
 
120
120
  The license of this project is located in [LICENSE]. By submitting a contribution to this project, you are agreeing that your contribution will be released under the terms of this license.
121
121
 
122
+ ## Maintainers
123
+ Some notes useful for Mesa maintainers.
124
+
125
+ ### Releases
126
+ To create a new release, follow these steps:
127
+
128
+ 1. Ensure all pull requests (PRs) have a clear title and are labeled with at least one label. Check [this link](https://github.com/projectmesa/mesa/pulls?q=is%3Apr+is%3Amerged+no%3Alabel+merged%3A%3E%3D2024-03-01+) to see if all PRs are labeled. These labels will be used when drafting the changelog using the [`.github/release.yml`](https://github.com/projectmesa/mesa/blob/main/.github/release.yml) configuration.
129
+ 2. Navigate to the [Releases](https://github.com/projectmesa/mesa/releases) section in the GitHub UI and click the _Draft a new release_ button.
130
+ 3. Specify the upcoming tag in the _Choose a tag_ and _Release title_ fields (e.g., `v3.0.0`).
131
+ - For pre-releases, add a `a`, `b` or `rc` and a number behind the version tag (see [Versioning](https://packaging.python.org/en/latest/discussions/versioning/)), and check the box _Set as a pre-release_.
132
+ 4. Use the _Generate release notes_ button to automatically create release notes. Review them carefully for accuracy, and update labels and edit PR titles if necessary (step 1).
133
+ 5. Write a _Highlights_ section summarizing the most important features or changes in this release.
134
+ 6. Copy the release notes and save them by clicking the grey _Save draft_ button.
135
+ 7. Open a new PR to update the version number in [`mesa/__init__.py`](https://github.com/projectmesa/mesa/blob/main/mesa/__init__.py) and add the copied release notes to the [`HISTORY.md`](https://github.com/projectmesa/mesa/blob/main/HISTORY.md).
136
+ 8. Once this PR is merged, return to the _Releases_ section and publish the draft release.
137
+ 9. The [`release.yml`](https://github.com/projectmesa/mesa/blob/main/.github/workflows/release.yml) CI workflow should automatically create and upload the package to PyPI. Verify this on [PyPI.org](https://pypi.org/project/mesa/).
138
+ 10. Finally, after release, open a new PR to update the version number in [`mesa/__init__.py`](https://github.com/projectmesa/mesa/blob/main/mesa/__init__.py) for the next release (e.g., `"3.1.0.dev"`).
139
+
122
140
  ## Special Thanks
123
141
 
124
142
  A special thanks to the following projects who offered inspiration for this contributing file.
@@ -1,6 +1,108 @@
1
1
  ---
2
2
  title: Release History
3
3
  ---
4
+ # 3.0.0b2 (2024-10-26)
5
+ ## Highlights
6
+ Mesa 3.0 beta 2 includes major work on the example models, docs, a new tutorial and visualisation.
7
+
8
+ The included example models are now part of the Mesa package itself and directly importable, using:
9
+ ```Python
10
+ from mesa.examples import BoidFlockers, BoltzmannWealthModel, ConwaysGameOfLife, ...
11
+ ```
12
+ The advanced examples were also restructured and cleaned up.
13
+
14
+ The tutorial was completely rewritten for Mesa 3.0, including it's latest features and practices. Many of our other docs also received some love, and almost everything is now ready for Mesa 3.0.
15
+
16
+ A new feature to remove all agents from the model was added, and the visualisation now supports drawing the experimental discrete spaces in both matplotlib and altair. All agents which are in a space can now conveniently be accessed with `.agents`.
17
+
18
+ The rarely used `mesa startproject` cookiecutter feature was removed. We updated our best-practice guide to include how to structure a modern Mesa project, which is now very straightforward.
19
+
20
+ ## What's Changed
21
+ ### ⚠️ Breaking changes
22
+ * remove cookiecutter by @quaquel in https://github.com/projectmesa/mesa/pull/2421
23
+ ### 🧪 Experimental features
24
+ * Add support for drawing discrete grids by @quaquel in https://github.com/projectmesa/mesa/pull/2386
25
+ * Altair spaces by @quaquel in https://github.com/projectmesa/mesa/pull/2397
26
+ ### 🎉 New features added
27
+ * remove_all_agents method added to model by @quaquel in https://github.com/projectmesa/mesa/pull/2394
28
+ * Pass through model.rgn in agent analogous to model.random by @quaquel in https://github.com/projectmesa/mesa/pull/2400
29
+ * add agents property to all spaces by @quaquel in https://github.com/projectmesa/mesa/pull/2418
30
+ ### 🛠 Enhancements made
31
+ * update_tutorial environment by @tpike3 in https://github.com/projectmesa/mesa/pull/2411
32
+ ### 🐛 Bugs fixed
33
+ * Fix for mistaken removal of _draw_grid by @quaquel in https://github.com/projectmesa/mesa/pull/2398
34
+ * fixes weakref bug in shuffe_do by @quaquel in https://github.com/projectmesa/mesa/pull/2399
35
+ ### 🔍 Examples updated
36
+ * refactor: Simplify Schelling code by @rht in https://github.com/projectmesa/mesa/pull/2353
37
+ * Move examples into mesa by @Corvince in https://github.com/projectmesa/mesa/pull/2387
38
+ * Explicitly test basic examples by @quaquel in https://github.com/projectmesa/mesa/pull/2390
39
+ * Make example import absolute by @quaquel in https://github.com/projectmesa/mesa/pull/2402
40
+ * Cleanup and restructure EpsteinCivilViolence and PdGrid examples by @EwoutH in https://github.com/projectmesa/mesa/pull/2408
41
+ * Reorganize advanced examples: wolf_sheep and sugarscape_g1mt by @quaquel in https://github.com/projectmesa/mesa/pull/2410
42
+ * reactivate ruff for advanced examples and include them in tests by @quaquel in https://github.com/projectmesa/mesa/pull/2414
43
+ ### 📜 Documentation improvements
44
+ * Include examples in readthedocs (port) by @EwoutH in https://github.com/projectmesa/mesa/pull/2392
45
+ * Update into_tutorial by @tpike3 in https://github.com/projectmesa/mesa/pull/2372
46
+ * Update Schelling Readme.md by @quaquel in https://github.com/projectmesa/mesa/pull/2406
47
+ * Update Conway example by @quaquel in https://github.com/projectmesa/mesa/pull/2403
48
+ * Boltzman readme by @quaquel in https://github.com/projectmesa/mesa/pull/2405
49
+ * Update Readme.md of Boid flockers by @quaquel in https://github.com/projectmesa/mesa/pull/2404
50
+ * add advanced examples to rtd by @quaquel in https://github.com/projectmesa/mesa/pull/2413
51
+ * Tutorial Improvements by @tpike3 in https://github.com/projectmesa/mesa/pull/2415
52
+ * space: Add note that Grids are maintenance only by @EwoutH in https://github.com/projectmesa/mesa/pull/2420
53
+ * Migration guide: Update automatic unique_id assignment examples by @EwoutH in https://github.com/projectmesa/mesa/pull/2419
54
+ * Update docstring of SimEvent by @quaquel in https://github.com/projectmesa/mesa/pull/2417
55
+ * best-practices: Update Model Layout section by @EwoutH in https://github.com/projectmesa/mesa/pull/2424
56
+ * docs: Clean-up index.md by @EwoutH in https://github.com/projectmesa/mesa/pull/2422
57
+ ### 🔧 Maintenance
58
+ * Add empty `pull_request_template.md` to enable PR template chooser by @EwoutH in https://github.com/projectmesa/mesa/pull/2409
59
+
60
+ **Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.0b1...v3.0.0b2
61
+
62
+ # 3.0.0b1 (2024-10-17)
63
+ ## Highlights
64
+ Mesa 3.0 beta 1 is our last beta release before the Mesa 3.0 stable release. We are restructuring our examples and have move 9 core examples from [mesa-examples](https://github.com/projectmesa/mesa-examples) to mesa itself ([#2358](https://github.com/projectmesa/mesa/pull/2358)). The 5 basic examples are now directly importable ([#2381](https://github.com/projectmesa/mesa/pull/2381)):
65
+ ```Python
66
+ from examples.basic import BoidFlockers, BoltzmannWealthModel, ConwaysGameOfLife, Schelling, VirusOnNetwork
67
+ ```
68
+ The 5 basic examples will always use stable Mesa features, we are also working on 4 more advanced example which can also include experimental features.
69
+
70
+ All our core examples can now be viewed in the [`examples`](https://github.com/projectmesa/mesa/tree/main/examples) folder. [mesa-examples](https://github.com/projectmesa/mesa-examples) will continue to exists for user showcases. We're also working on making the examples visible in the ReadtheDocs ([#2382](https://github.com/projectmesa/mesa/pull/2382)) and on an website ([mesa-examples#139](https://github.com/projectmesa/mesa-examples/issues/139)). Follow all our work on the examples in this tracking issue [#2364](https://github.com/projectmesa/mesa/issues/2364).
71
+
72
+ Furthermore, the visualizations are improved by making visualization elements scalable and more clearly labeling the plots, and the Model now has an `rng` argument for an [SPEC 7](https://scientific-python.org/specs/spec-0007/) compliant NumPy random number generator ([#2352](https://github.com/projectmesa/mesa/pull/2352)). Following SPEC 7, you have to pass either `seed` or `rng`. Whichever one you pass will be used to seed both `random.Random`, and `numpy.random.Generator.`
73
+
74
+ ## What's Changed
75
+ ### ⚠️ Breaking changes
76
+ * replace model with random in AgentSet init by @quaquel in https://github.com/projectmesa/mesa/pull/2350
77
+ ### 🧪 Experimental features
78
+ * cell space: Add convenience properties for grid width and height by @quaquel in https://github.com/projectmesa/mesa/pull/2348
79
+ * Bugfix for deepcopy / pickling discrete spaces by @quaquel in https://github.com/projectmesa/mesa/pull/2378
80
+ ### 🎉 New features added
81
+ * Move core example models back (v2) by @EwoutH in https://github.com/projectmesa/mesa/pull/2358
82
+ * Add Model.rng for SPEC-7 compliant numpy random number generation by @quaquel in https://github.com/projectmesa/mesa/pull/2352
83
+ ### 🛠 Enhancements made
84
+ * use GridDraggable instead of Column in SolaraViz by @wang-boyu in https://github.com/projectmesa/mesa/pull/2344
85
+ * update legend, xlabel & format of matplotlib plots by @wang-boyu in https://github.com/projectmesa/mesa/pull/2346
86
+ * __init__.py: Import mesa.experimental by @EwoutH in https://github.com/projectmesa/mesa/pull/2374
87
+ * Importable examples by @Corvince in https://github.com/projectmesa/mesa/pull/2381
88
+ ### 🐛 Bugs fixed
89
+ * experimental init: Fix Solara import by making it lazy by @EwoutH in https://github.com/projectmesa/mesa/pull/2357
90
+ * fix: pass `model.random` to schedulers by @quaquel in https://github.com/projectmesa/mesa/pull/2359
91
+ * fix: register agent after creating unique_id and pos attributes by @wang-boyu in https://github.com/projectmesa/mesa/pull/2368
92
+ * solara: viz tutorial: fix histogram code by @Corvince in https://github.com/projectmesa/mesa/pull/2379
93
+ ### 🔍 Examples updated
94
+ * Cleanup and restructure basic example models by @EwoutH in https://github.com/projectmesa/mesa/pull/2365
95
+ * Ruff basic examples by @EwoutH in https://github.com/projectmesa/mesa/pull/2370
96
+ ### 📜 Documentation improvements
97
+ * Update migration_guide.md by @quaquel in https://github.com/projectmesa/mesa/pull/2347
98
+ ### 🔧 Maintenance
99
+ * Code coverage: ignore experimental and visualization by @Corvince in https://github.com/projectmesa/mesa/pull/2361
100
+ * add codecov token, fixes #2363 by @Corvince in https://github.com/projectmesa/mesa/pull/2366
101
+ * add test_time back by @quaquel in https://github.com/projectmesa/mesa/pull/2367
102
+ * Release notes: Add example category by @EwoutH in https://github.com/projectmesa/mesa/pull/2369
103
+
104
+ **Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.0b0...v3.0.0b1
105
+
4
106
  # 3.0.0b0 (2024-10-04)
5
107
  ## Highlights
6
108
  We're proud to release the first Mesa 3.0 beta! This pre-release announces that we're ready for Mesa 3.0 to be tested by all our regular users. We try to not making breaking changes anymore, but focus on resolving bugs and imperfections.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: Mesa
3
- Version: 3.0.0b0
3
+ Version: 3.0.0b2
4
4
  Summary: Agent-based modeling (ABM) in Python
5
5
  Project-URL: homepage, https://github.com/projectmesa/mesa
6
6
  Project-URL: repository, https://github.com/projectmesa/mesa
@@ -27,7 +27,6 @@ Requires-Dist: numpy
27
27
  Requires-Dist: pandas
28
28
  Requires-Dist: tqdm
29
29
  Provides-Extra: all
30
- Requires-Dist: cookiecutter; extra == 'all'
31
30
  Requires-Dist: ipython; extra == 'all'
32
31
  Requires-Dist: matplotlib; extra == 'all'
33
32
  Requires-Dist: myst-nb; extra == 'all'
@@ -43,7 +42,6 @@ Requires-Dist: seaborn; extra == 'all'
43
42
  Requires-Dist: solara; extra == 'all'
44
43
  Requires-Dist: sphinx; extra == 'all'
45
44
  Provides-Extra: dev
46
- Requires-Dist: cookiecutter; extra == 'dev'
47
45
  Requires-Dist: matplotlib; extra == 'dev'
48
46
  Requires-Dist: networkx; extra == 'dev'
49
47
  Requires-Dist: pytest; extra == 'dev'
@@ -70,7 +70,7 @@ class BoltzmannWealth(mesa.Model):
70
70
  n: the number of steps for which to run the model
71
71
 
72
72
  """
73
- for _i in range(n):
73
+ for _ in range(n):
74
74
  self.step()
75
75
 
76
76
 
@@ -34,11 +34,10 @@ class SchellingAgent(CellAgent):
34
34
 
35
35
  def step(self):
36
36
  """Run one step of the agent."""
37
- similar = 0
38
- neighborhood = self.cell.get_neighborhood(radius=self.radius)
39
- for neighbor in neighborhood.agents:
40
- if neighbor.type == self.type:
41
- similar += 1
37
+ neighbors = self.cell.get_neighborhood(radius=self.radius).agents
38
+ similar = len(
39
+ [neighbor for neighbor in neighbors if neighbor.type == self.type]
40
+ )
42
41
 
43
42
  # If unhappy, move:
44
43
  if similar < self.homophily:
@@ -76,7 +75,6 @@ class Schelling(Model):
76
75
  """
77
76
  super().__init__(seed=seed)
78
77
  self.simulator = simulator
79
- self.minority_pc = minority_pc
80
78
  self.happy = 0
81
79
 
82
80
  self.grid = OrthogonalMooreGrid(
@@ -92,7 +90,7 @@ class Schelling(Model):
92
90
  # its contents. (coord_iter)
93
91
  for cell in self.grid:
94
92
  if self.random.random() < density:
95
- agent_type = 1 if self.random.random() < self.minority_pc else 0
93
+ agent_type = 1 if self.random.random() < minority_pc else 0
96
94
  SchellingAgent(self, agent_type, radius, homophily, cell)
97
95
 
98
96
  def step(self):
@@ -0,0 +1,14 @@
1
+ name: example-environment
2
+ channels:
3
+ - conda-forge
4
+ dependencies:
5
+ - python
6
+ - numpy
7
+ - pip
8
+ - pip:
9
+ - nbgitpuller
10
+ - pandas
11
+ - matplotlib
12
+ - seaborn
13
+ - solara
14
+ - mesa[rec]==3.0.0b1
@@ -2,11 +2,12 @@ coverage:
2
2
  status:
3
3
  project:
4
4
  default:
5
- target: 90%
5
+ target: 80%
6
6
  threshold: 1%
7
7
 
8
8
  ignore:
9
- - "**experimental/"
10
9
  - "benchmarks/**"
10
+ - "mesa/experimental/**"
11
+ - "mesa/visualization/**"
11
12
 
12
13
  comment: off
@@ -1,15 +1,14 @@
1
- Docs for Mesa
2
- =============
1
+ # Docs for Mesa
3
2
 
4
3
  The readable version of the docs is hosted at [mesa.readthedocs.org](http://mesa.readthedocs.org/).
5
4
 
6
5
  This folder contains the docs that build the docs for the core mesa code on readthdocs.
7
6
 
8
- ### How to publish updates to the docs
7
+ ## How to publish updates to the docs
9
8
 
10
9
  Updating docs can be confusing. Here are the basic setups.
11
10
 
12
- ##### Submit a pull request with updates
11
+ #### Submit a pull request with updates
13
12
  1. Create branch (either via branching or fork of repo) -- try to use a descriptive name.
14
13
  * `git checkout -b doc-updates`
15
14
  1. Update the docs. Save.
@@ -23,7 +22,7 @@ Updating docs can be confusing. Here are the basic setups.
23
22
  * `git push origin doc-updates`
24
23
  1. From here you will want to submit a pull request to main.
25
24
 
26
- ##### Update read the docs
25
+ #### Update read the docs
27
26
 
28
27
  From this point, you will need to find someone that has access to readthedocs. Currently, that is [@jackiekazil](https://github.com/jackiekazil), [@rht](https://github.com/rht), and [@tpike3](https://github.com/dmasad).
29
28
 
@@ -3,11 +3,6 @@ This namespace contains experimental features. These are under development, and
3
3
 
4
4
  ## Cell Space
5
5
 
6
- ```{eval-rst}
7
- .. automodule:: experimental.cell_space.__init__
8
- :members:
9
- ```
10
-
11
6
  ```{eval-rst}
12
7
  .. automodule:: experimental.cell_space.cell
13
8
  :members:
@@ -40,11 +35,6 @@ This namespace contains experimental features. These are under development, and
40
35
 
41
36
  ## Devs
42
37
 
43
- ```{eval-rst}
44
- .. automodule:: experimental.devs.__init__
45
- :members:
46
- ```
47
-
48
38
  ```{eval-rst}
49
39
  .. automodule:: experimental.devs.eventlist
50
40
  :members:
@@ -5,26 +5,21 @@ Here are some general principles that have proven helpful for developing models.
5
5
  ## Model Layout
6
6
 
7
7
  A model should be contained in a folder named with lower-case letters and
8
- underscores, such as `thunder_cats`. Within that directory:
9
-
10
- - `README.md` describes the model, how to use it, and any other details.
11
- Github will automatically show this file to anyone visiting the directory.
12
- - `model.py` should contain the model class. If the file gets large, it may
13
- make sense to move the complex bits into other files, but this is the first
14
- place readers will look to figure out how the model works.
15
- - `server.py` should contain the visualization support, including the server
16
- class.
17
- - `run.py` is a Python script that will run the model when invoked via
18
- `mesa runserver`.
19
-
20
- After the number of files grows beyond a half-dozen, try to use sub-folders to
21
- organize them. For example, if the visualization uses image files, put those in
22
- an `images` directory.
23
-
24
- The [Schelling](https://github.com/projectmesa/mesa-examples/tree/main/examples/schelling) model is
25
- a good example of a small well-packaged model.
26
-
27
- It's easy to create a cookiecutter mesa model by running `mesa startproject`
8
+ underscores, such as `wolf_sheep`. Within that directory:
9
+
10
+ - `Readme.md` describes the model, how to use it, and any other details.
11
+ - `model.py` should contain the model class.
12
+ - `agents.py` should contain the agent class(es).
13
+ - `app.py` should contain the Solara-based visualization code (optional).
14
+
15
+ You can add more files as needed, for example:
16
+ - `run.py` could contain the code to run the model.
17
+ - `batch_run.py` could contain the code to run the model multiple times.
18
+ - `analysis.py` could contain any analysis code.
19
+
20
+ Input data can be stored in a `data` directory, output data in an `output`, processed results in a `results` directory, images in an `images` directory, etc.
21
+
22
+ All our [examples](examples) follow this layout.
28
23
 
29
24
  ## Randomization
30
25
 
@@ -14,14 +14,17 @@
14
14
  # serve to show the default.
15
15
 
16
16
  import os
17
+ import os.path as osp
18
+ import pathlib
17
19
  import sys
20
+ import string
18
21
  from datetime import date
19
22
 
20
23
  # If extensions (or modules to document with autodoc) are in another directory,
21
24
  # add these directories to sys.path here. If the directory is relative to the
22
25
  # documentation root, use os.path.abspath to make it absolute, like shown here.
26
+ HERE = osp.abspath(osp.dirname(__file__))
23
27
  sys.path.insert(0, os.path.abspath("."))
24
- sys.path.insert(0, "../examples")
25
28
  sys.path.insert(0, "../mesa")
26
29
 
27
30
 
@@ -289,3 +292,69 @@ texinfo_documents = [
289
292
 
290
293
  # Example configuration for intersphinx: refer to the Python standard library.
291
294
  intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
295
+
296
+
297
+
298
+ def write_example_md_file(agent_filename, model_filename, readme_filename, app_filename, md_filepath, template):
299
+ with open(agent_filename) as content_file:
300
+ agent_file = content_file.read()
301
+ with open(model_filename) as content_file:
302
+ model_file = content_file.read()
303
+ with open(readme_filename) as content_file:
304
+ readme_file = content_file.read()
305
+ with open(app_filename) as content_file:
306
+ app_file = content_file.read()
307
+
308
+ with open(md_filepath, "w") as fh:
309
+ content = template.substitute(
310
+ dict(agent_file=agent_file, model_file=model_file,
311
+ readme_file=readme_file, app_file=app_file)
312
+ )
313
+ fh.write(content)
314
+
315
+ def setup_examples_pages():
316
+ # create md files for all examples
317
+ # check what examples exist
318
+ examples_folder = osp.abspath(osp.join(HERE, "..", "mesa", "examples"))
319
+ basic_examples = [f.path for f in os.scandir(osp.join(examples_folder, "basic")) if f.is_dir() and not f.name.startswith("__") ]
320
+ advanced_examples = [f.path for f in os.scandir(osp.join(examples_folder, "advanced")) if f.is_dir() and not f.name.startswith("__")]
321
+ examples = basic_examples + advanced_examples
322
+
323
+ with open(os.path.join(HERE, "example_template.txt")) as fh:
324
+ template = string.Template(fh.read())
325
+
326
+ pathlib.Path(os.path.join(HERE, "examples")).mkdir(parents=True, exist_ok=True)
327
+
328
+ examples_md = []
329
+ for example in examples:
330
+ base_name = os.path.basename(os.path.normpath(example))
331
+
332
+ agent_filename = os.path.join(example, "agents.py")
333
+ model_filename = os.path.join(example, "model.py")
334
+ readme_filename = os.path.join(example, "Readme.md")
335
+ app_filename = os.path.join(example, "app.py")
336
+
337
+ md_filename = f"{base_name}.md"
338
+ examples_md.append(base_name)
339
+
340
+ md_filepath = os.path.join(HERE, "examples", md_filename)
341
+ write_example_md_file(agent_filename, model_filename, readme_filename, app_filename, md_filepath, template)
342
+
343
+ # create overview of examples.md
344
+ with open(os.path.join(HERE, "examples_overview_template.txt")) as fh:
345
+ template = string.Template(fh.read())
346
+
347
+ with open(os.path.join(HERE, "examples.md"), "w") as fh:
348
+ content = template.substitute(
349
+ dict(
350
+ examples="\n".join([f"{' '.join(base_name.split('_'))} </examples/{base_name}>" for base_name in examples_md]),
351
+ )
352
+ )
353
+ fh.write(content)
354
+
355
+ def setup(app):
356
+ setup_examples_pages()
357
+
358
+ #
359
+ if __name__ == "__main__":
360
+ setup_examples_pages()
@@ -0,0 +1,22 @@
1
+
2
+ $readme_file
3
+
4
+ ## Agents
5
+
6
+ ```python
7
+ $agent_file
8
+ ```
9
+
10
+
11
+ ## Model
12
+
13
+ ```python
14
+ $model_file
15
+ ```
16
+
17
+
18
+ ## App
19
+
20
+ ```python
21
+ $app_file
22
+ ```
@@ -0,0 +1,14 @@
1
+
2
+ # Examples
3
+
4
+
5
+ ```{toctree}
6
+ :maxdepth: 1
7
+
8
+ boid flockers </examples/boid_flockers>
9
+ virus on network </examples/virus_on_network>
10
+ conways game of life </examples/conways_game_of_life>
11
+ schelling </examples/schelling>
12
+ boltzmann wealth model </examples/boltzmann_wealth_model>
13
+
14
+ ```
@@ -0,0 +1,10 @@
1
+
2
+ # Examples
3
+
4
+
5
+ ```{toctree}
6
+ :maxdepth: 1
7
+
8
+ $examples
9
+
10
+ ```
@@ -2,6 +2,45 @@
2
2
 
3
3
  This guide provides concise instructions and examples to help you start with common tasks in Mesa.
4
4
 
5
+ ## Implementing Different Activation Regimes
6
+
7
+
8
+ ### Random Activation
9
+
10
+ self.agents.shuffle_do("<agent function>")
11
+
12
+ ### Random Activation By Type
13
+
14
+ ```python
15
+ for agent_class in self.agent_types:
16
+ self.agents_by_type[agent_class].shuffle_do("<agent function>")
17
+ ```
18
+ ### Only Activating Certain Agent Types
19
+
20
+ ```python
21
+ self.agents_by_type[AgentType].shuffle_do("<agent function>")
22
+ ```
23
+
24
+ ### Staged Activation
25
+
26
+ ```python
27
+ for stage in ["stage1", "stage2", "stage3"]:
28
+ self.agents.do(stage)
29
+ ```
30
+
31
+ If you want to `shuffle` and/or `shuffle_between_stages` options:
32
+ ```python
33
+
34
+ stages = ["stage1", "stage2", "stage3"]
35
+ if shuffle:
36
+ self.random.shuffle(stages)
37
+ for stage in stages:
38
+ if shuffle_between_stages:
39
+ self.agents.shuffle_do(stage)
40
+ else:
41
+ self.agents.do(stage)
42
+ ```
43
+
5
44
  ## Models with Discrete Time
6
45
 
7
46
  For models involving agents of multiple types, including those with a time attribute, you can construct a discrete-time model. This setup allows each agent to perform actions in steps that correspond to the model's discrete time.
Binary file