Mesa 3.0.0b1__tar.gz → 3.0.0rc0__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 (236) hide show
  1. mesa-3.0.0rc0/.github/pull_request_template.md +4 -0
  2. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.gitignore +4 -0
  3. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.pre-commit-config.yaml +3 -3
  4. {mesa-3.0.0b1 → mesa-3.0.0rc0}/HISTORY.md +64 -4
  5. {mesa-3.0.0b1 → mesa-3.0.0rc0}/PKG-INFO +1 -3
  6. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/Schelling/schelling.py +5 -7
  7. mesa-3.0.0rc0/binder/environment.yml +14 -0
  8. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/README.md +4 -5
  9. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/apis/experimental.md +0 -10
  10. mesa-3.0.0rc0/docs/apis/visualization.md +47 -0
  11. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/best-practices.md +15 -20
  12. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/conf.py +77 -1
  13. mesa-3.0.0rc0/docs/example_template.txt +22 -0
  14. mesa-3.0.0rc0/docs/examples_overview_template.txt +3 -0
  15. mesa-3.0.0rc0/docs/images/wolf_sheep.png +0 -0
  16. mesa-3.0.0rc0/docs/index.md +101 -0
  17. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/migration_guide.md +29 -8
  18. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/overview.md +10 -5
  19. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/packages.md +2 -2
  20. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/MoneyModel.py +2 -2
  21. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/intro_tutorial.ipynb +663 -237
  22. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/visualization_tutorial.ipynb +204 -69
  23. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/__init__.py +1 -3
  24. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/agent.py +23 -8
  25. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/batchrunner.py +26 -1
  26. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/README.md +11 -11
  27. mesa-3.0.0rc0/mesa/examples/__init__.py +21 -0
  28. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/advanced/epstein_civil_violence/Readme.md +3 -2
  29. mesa-3.0.0b1/examples/advanced/epstein_civil_violence/epstein_civil_violence/agent.py → mesa-3.0.0rc0/mesa/examples/advanced/epstein_civil_violence/agents.py +44 -38
  30. mesa-3.0.0rc0/mesa/examples/advanced/epstein_civil_violence/app.py +73 -0
  31. mesa-3.0.0rc0/mesa/examples/advanced/epstein_civil_violence/model.py +114 -0
  32. mesa-3.0.0b1/examples/advanced/pd_grid/readme.md → mesa-3.0.0rc0/mesa/examples/advanced/pd_grid/Readme.md +4 -3
  33. mesa-3.0.0rc0/mesa/examples/advanced/pd_grid/app.py +54 -0
  34. {mesa-3.0.0b1/examples/advanced/pd_grid → mesa-3.0.0rc0/mesa/examples/advanced}/pd_grid/model.py +1 -2
  35. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/advanced/sugarscape_g1mt/Readme.md +6 -29
  36. mesa-3.0.0b1/examples/advanced/sugarscape_g1mt/sugarscape_g1mt/trader_agents.py → mesa-3.0.0rc0/mesa/examples/advanced/sugarscape_g1mt/agents.py +26 -3
  37. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/advanced/sugarscape_g1mt/app.py +19 -18
  38. {mesa-3.0.0b1/examples/advanced/sugarscape_g1mt → mesa-3.0.0rc0/mesa/examples/advanced}/sugarscape_g1mt/model.py +6 -6
  39. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/advanced/sugarscape_g1mt/tests.py +3 -6
  40. mesa-3.0.0rc0/mesa/examples/advanced/wolf_sheep/app.py +84 -0
  41. {mesa-3.0.0b1/examples/advanced/wolf_sheep → mesa-3.0.0rc0/mesa/examples/advanced}/wolf_sheep/model.py +9 -8
  42. mesa-3.0.0rc0/mesa/examples/basic/boid_flockers/Readme.md +22 -0
  43. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/boid_flockers/app.py +3 -4
  44. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/boid_flockers/model.py +1 -2
  45. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/boltzmann_wealth_model/Readme.md +1 -5
  46. mesa-3.0.0rc0/mesa/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
  47. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/boltzmann_wealth_model/app.py +15 -12
  48. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/boltzmann_wealth_model/model.py +3 -4
  49. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/conways_game_of_life/Readme.md +11 -7
  50. mesa-3.0.0rc0/mesa/examples/basic/conways_game_of_life/__init__.py +0 -0
  51. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/conways_game_of_life/agents.py +8 -8
  52. mesa-3.0.0rc0/mesa/examples/basic/conways_game_of_life/app.py +51 -0
  53. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/conways_game_of_life/model.py +3 -4
  54. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/conways_game_of_life/st_app.py +2 -1
  55. mesa-3.0.0b1/examples/basic/schelling/README.md → mesa-3.0.0rc0/mesa/examples/basic/schelling/Readme.md +2 -9
  56. mesa-3.0.0rc0/mesa/examples/basic/schelling/__init__.py +0 -0
  57. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/schelling/app.py +6 -7
  58. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/schelling/model.py +1 -2
  59. mesa-3.0.0rc0/mesa/examples/basic/virus_on_network/__init__.py +0 -0
  60. mesa-3.0.0rc0/mesa/examples/basic/virus_on_network/app.py +114 -0
  61. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/virus_on_network/model.py +4 -7
  62. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/cell_space/discrete_space.py +6 -0
  63. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/devs/eventlist.py +6 -0
  64. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/model.py +13 -0
  65. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/space.py +70 -35
  66. mesa-3.0.0rc0/mesa/visualization/__init__.py +26 -0
  67. mesa-3.0.0rc0/mesa/visualization/components/__init__.py +83 -0
  68. mesa-3.0.0rc0/mesa/visualization/components/altair_components.py +188 -0
  69. mesa-3.0.0rc0/mesa/visualization/components/matplotlib_components.py +176 -0
  70. mesa-3.0.0rc0/mesa/visualization/mpl_space_drawing.py +558 -0
  71. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/visualization/solara_viz.py +30 -20
  72. {mesa-3.0.0b1 → mesa-3.0.0rc0}/pyproject.toml +3 -4
  73. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_agent.py +31 -0
  74. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_cell_space.py +20 -0
  75. mesa-3.0.0rc0/tests/test_components_matplotlib.py +158 -0
  76. mesa-3.0.0rc0/tests/test_examples.py +72 -0
  77. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_model.py +15 -0
  78. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_solara_viz.py +59 -11
  79. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_space.py +21 -0
  80. mesa-3.0.0b1/docs/apis/visualization.md +0 -21
  81. mesa-3.0.0b1/docs/howto.md +0 -83
  82. mesa-3.0.0b1/docs/images/Mesa_Screenshot.png +0 -0
  83. mesa-3.0.0b1/docs/index.md +0 -115
  84. mesa-3.0.0b1/examples/advanced/epstein_civil_violence/epstein_civil_violence/model.py +0 -146
  85. mesa-3.0.0b1/examples/advanced/epstein_civil_violence/epstein_civil_violence/portrayal.py +0 -33
  86. mesa-3.0.0b1/examples/advanced/epstein_civil_violence/epstein_civil_violence/server.py +0 -81
  87. mesa-3.0.0b1/examples/advanced/epstein_civil_violence/requirements.txt +0 -3
  88. mesa-3.0.0b1/examples/advanced/epstein_civil_violence/run.py +0 -3
  89. mesa-3.0.0b1/examples/advanced/pd_grid/pd_grid/portrayal.py +0 -19
  90. mesa-3.0.0b1/examples/advanced/pd_grid/pd_grid/server.py +0 -21
  91. mesa-3.0.0b1/examples/advanced/pd_grid/requirements.txt +0 -3
  92. mesa-3.0.0b1/examples/advanced/pd_grid/run.py +0 -3
  93. mesa-3.0.0b1/examples/advanced/sugarscape_g1mt/requirements.txt +0 -6
  94. mesa-3.0.0b1/examples/advanced/sugarscape_g1mt/run.py +0 -105
  95. mesa-3.0.0b1/examples/advanced/sugarscape_g1mt/sugarscape_g1mt/resource_agents.py +0 -26
  96. mesa-3.0.0b1/examples/advanced/sugarscape_g1mt/sugarscape_g1mt/server.py +0 -61
  97. mesa-3.0.0b1/examples/advanced/wolf_sheep/requirements.txt +0 -1
  98. mesa-3.0.0b1/examples/advanced/wolf_sheep/run.py +0 -3
  99. mesa-3.0.0b1/examples/advanced/wolf_sheep/wolf_sheep/resources/sheep.png +0 -0
  100. mesa-3.0.0b1/examples/advanced/wolf_sheep/wolf_sheep/resources/wolf.png +0 -0
  101. mesa-3.0.0b1/examples/advanced/wolf_sheep/wolf_sheep/server.py +0 -78
  102. mesa-3.0.0b1/examples/basic/__init__.py +0 -13
  103. mesa-3.0.0b1/examples/basic/boid_flockers/Readme.md +0 -43
  104. mesa-3.0.0b1/examples/basic/conways_game_of_life/portrayal.py +0 -18
  105. mesa-3.0.0b1/examples/basic/conways_game_of_life/requirements.txt +0 -1
  106. mesa-3.0.0b1/examples/basic/conways_game_of_life/server.py +0 -11
  107. mesa-3.0.0b1/examples/basic/virus_on_network/app.py +0 -133
  108. mesa-3.0.0b1/mesa/cookiecutter-mesa/cookiecutter.json +0 -8
  109. mesa-3.0.0b1/mesa/cookiecutter-mesa/hooks/post_gen_project.py +0 -13
  110. mesa-3.0.0b1/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md +0 -4
  111. mesa-3.0.0b1/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate +0 -27
  112. mesa-3.0.0b1/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate +0 -11
  113. mesa-3.0.0b1/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py +0 -1
  114. mesa-3.0.0b1/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate +0 -60
  115. mesa-3.0.0b1/mesa/examples.py +0 -3
  116. mesa-3.0.0b1/mesa/main.py +0 -65
  117. mesa-3.0.0b1/mesa/visualization/__init__.py +0 -15
  118. mesa-3.0.0b1/mesa/visualization/components/altair.py +0 -88
  119. mesa-3.0.0b1/mesa/visualization/components/matplotlib.py +0 -342
  120. mesa-3.0.0b1/tests/test_examples.py +0 -88
  121. mesa-3.0.0b1/tests/test_scaffold.py +0 -21
  122. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.codespellignore +0 -0
  123. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.coveragerc +0 -0
  124. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
  125. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  126. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  127. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/PULL_REQUEST_TEMPLATE/bug.md +0 -0
  128. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  129. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/dependabot.yml +0 -0
  130. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/release.yml +0 -0
  131. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/workflows/benchmarks.yml +0 -0
  132. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/workflows/build_lint.yml +0 -0
  133. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.github/workflows/release.yml +0 -0
  134. {mesa-3.0.0b1 → mesa-3.0.0rc0}/.readthedocs.yml +0 -0
  135. {mesa-3.0.0b1 → mesa-3.0.0rc0}/CITATION.bib +0 -0
  136. {mesa-3.0.0b1 → mesa-3.0.0rc0}/CODE_OF_CONDUCT.md +0 -0
  137. {mesa-3.0.0b1 → mesa-3.0.0rc0}/CONTRIBUTING.md +0 -0
  138. {mesa-3.0.0b1 → mesa-3.0.0rc0}/Dockerfile +0 -0
  139. {mesa-3.0.0b1 → mesa-3.0.0rc0}/LICENSE +0 -0
  140. {mesa-3.0.0b1 → mesa-3.0.0rc0}/NOTICE +0 -0
  141. {mesa-3.0.0b1 → mesa-3.0.0rc0}/README.md +0 -0
  142. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/BoltzmannWealth/__init__.py +0 -0
  143. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/BoltzmannWealth/boltzmann_wealth.py +0 -0
  144. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/Flocking/__init__.py +0 -0
  145. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/Flocking/flocking.py +0 -0
  146. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/Schelling/__init__.py +0 -0
  147. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/WolfSheep/__init__.py +0 -0
  148. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/WolfSheep/wolf_sheep.py +0 -0
  149. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/compare_timings.py +0 -0
  150. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/configurations.py +0 -0
  151. {mesa-3.0.0b1 → mesa-3.0.0rc0}/benchmarks/global_benchmark.py +0 -0
  152. {mesa-3.0.0b1 → mesa-3.0.0rc0}/codecov.yaml +0 -0
  153. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docker-compose.yml +0 -0
  154. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/Makefile +0 -0
  155. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/_static/switcher.json +0 -0
  156. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/apis/agent.md +0 -0
  157. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/apis/api_main.md +0 -0
  158. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/apis/batchrunner.md +0 -0
  159. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/apis/datacollection.md +0 -0
  160. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/apis/model.md +0 -0
  161. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/apis/space.md +0 -0
  162. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/apis/time.md +0 -0
  163. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/mesa_logo.ico +0 -0
  164. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/mesa_logo.png +0 -0
  165. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/br_ginis.png +0 -0
  166. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/dc_endwealth.png +0 -0
  167. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/dc_gini.png +0 -0
  168. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/dc_oneagent.png +0 -0
  169. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/first_hist.png +0 -0
  170. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/multirun_hist.png +0 -0
  171. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/numpy_grid.png +0 -0
  172. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/viz_chart.png +0 -0
  173. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/viz_empty.png +0 -0
  174. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/viz_greycircles.png +0 -0
  175. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/viz_histogram.png +0 -0
  176. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/images/tutorial/viz_redcircles.png +0 -0
  177. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/make.bat +0 -0
  178. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/mesa.md +0 -0
  179. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/files/viz_chart.png +0 -0
  180. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/files/viz_empty.png +0 -0
  181. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/files/viz_greycircles.png +0 -0
  182. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/files/viz_histogram.png +0 -0
  183. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/files/viz_redcircles.png +0 -0
  184. {mesa-3.0.0b1 → mesa-3.0.0rc0}/docs/tutorials/files/viz_slider.png +0 -0
  185. {mesa-3.0.0b1 → mesa-3.0.0rc0}/maintenance/fetch_unlabeled_prs.py +0 -0
  186. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/datacollection.py +0 -0
  187. {mesa-3.0.0b1/examples → mesa-3.0.0rc0/mesa/examples/advanced}/__init__.py +0 -0
  188. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +0 -0
  189. {mesa-3.0.0b1/examples/advanced → mesa-3.0.0rc0/mesa/examples/advanced/epstein_civil_violence}/__init__.py +0 -0
  190. {mesa-3.0.0b1/examples/advanced/epstein_civil_violence/epstein_civil_violence → mesa-3.0.0rc0/mesa/examples/advanced/pd_grid}/__init__.py +0 -0
  191. /mesa-3.0.0b1/examples/advanced/pd_grid/pd_grid/agent.py → /mesa-3.0.0rc0/mesa/examples/advanced/pd_grid/agents.py +0 -0
  192. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/advanced/pd_grid/analysis.ipynb +0 -0
  193. {mesa-3.0.0b1/examples/advanced/pd_grid/pd_grid → mesa-3.0.0rc0/mesa/examples/advanced/sugarscape_g1mt}/__init__.py +0 -0
  194. {mesa-3.0.0b1/examples/advanced/sugarscape_g1mt → mesa-3.0.0rc0/mesa/examples/advanced}/sugarscape_g1mt/sugar-map.txt +0 -0
  195. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/advanced/wolf_sheep/Readme.md +0 -0
  196. {mesa-3.0.0b1/examples/advanced/sugarscape_g1mt/sugarscape_g1mt → mesa-3.0.0rc0/mesa/examples/advanced/wolf_sheep}/__init__.py +0 -0
  197. {mesa-3.0.0b1/examples/advanced/wolf_sheep → mesa-3.0.0rc0/mesa/examples/advanced}/wolf_sheep/agents.py +0 -0
  198. {mesa-3.0.0b1/examples/advanced/wolf_sheep → mesa-3.0.0rc0/mesa/examples/basic}/__init__.py +0 -0
  199. {mesa-3.0.0b1/examples/advanced/wolf_sheep/wolf_sheep → mesa-3.0.0rc0/mesa/examples/basic/boid_flockers}/__init__.py +0 -0
  200. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/boid_flockers/agents.py +0 -0
  201. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/boltzmann_wealth_model/agents.py +0 -0
  202. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/boltzmann_wealth_model/st_app.py +0 -0
  203. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/schelling/agents.py +0 -0
  204. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/schelling/analysis.ipynb +0 -0
  205. /mesa-3.0.0b1/examples/basic/virus_on_network/README.md → /mesa-3.0.0rc0/mesa/examples/basic/virus_on_network/Readme.md +0 -0
  206. {mesa-3.0.0b1 → mesa-3.0.0rc0/mesa}/examples/basic/virus_on_network/agents.py +0 -0
  207. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/UserParam.py +0 -0
  208. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/__init__.py +0 -0
  209. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/cell_space/__init__.py +0 -0
  210. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/cell_space/cell.py +0 -0
  211. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/cell_space/cell_agent.py +0 -0
  212. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/cell_space/cell_collection.py +0 -0
  213. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/cell_space/grid.py +0 -0
  214. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/cell_space/network.py +0 -0
  215. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/cell_space/voronoi.py +0 -0
  216. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/components/altair.py +0 -0
  217. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/components/matplotlib.py +0 -0
  218. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/devs/__init__.py +0 -0
  219. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/devs/examples/epstein_civil_violence.py +0 -0
  220. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/devs/examples/wolf_sheep.py +0 -0
  221. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/devs/simulator.py +0 -0
  222. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/experimental/solara_viz.py +0 -0
  223. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/time.py +0 -0
  224. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/visualization/UserParam.py +0 -0
  225. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mesa/visualization/utils.py +0 -0
  226. {mesa-3.0.0b1 → mesa-3.0.0rc0}/mypy.ini +0 -0
  227. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/__init__.py +0 -0
  228. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/read_requirements.py +0 -0
  229. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_batch_run.py +0 -0
  230. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_datacollector.py +0 -0
  231. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_devs.py +0 -0
  232. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_end_to_end_viz.sh +0 -0
  233. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_grid.py +0 -0
  234. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_import_namespace.py +0 -0
  235. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_lifespan.py +0 -0
  236. {mesa-3.0.0b1 → mesa-3.0.0rc0}/tests/test_time.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)
@@ -1,6 +1,10 @@
1
1
  # Benchmarking
2
2
  benchmarks/**/*.pickle
3
3
 
4
+ # exampledocs
5
+ docs/examples/*
6
+ docs/example.md
7
+
4
8
  # Byte-compiled / optimized / DLL files
5
9
  __pycache__/
6
10
  *.py[cod]
@@ -4,7 +4,7 @@ ci:
4
4
  repos:
5
5
  - repo: https://github.com/astral-sh/ruff-pre-commit
6
6
  # Ruff version.
7
- rev: v0.6.3
7
+ rev: v0.7.2
8
8
  hooks:
9
9
  # Run the linter.
10
10
  - id: ruff
@@ -14,12 +14,12 @@ repos:
14
14
  - id: ruff-format
15
15
  types_or: [ python, pyi, jupyter ]
16
16
  - repo: https://github.com/asottile/pyupgrade
17
- rev: v3.17.0
17
+ rev: v3.19.0
18
18
  hooks:
19
19
  - id: pyupgrade
20
20
  args: [--py310-plus]
21
21
  - repo: https://github.com/pre-commit/pre-commit-hooks
22
- rev: v4.6.0 # Use the ref you want to point at
22
+ rev: v5.0.0 # Use the ref you want to point at
23
23
  hooks:
24
24
  - id: trailing-whitespace
25
25
  - id: check-toml
@@ -1,15 +1,75 @@
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.
4
7
 
5
- # 3.0.0b1 (2024-10-17)
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`.
6
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)
7
63
  ## Highlights
8
- Basic exmaples are now importable in Mesa, includes boid_flockers, boltzmann_wealth_model, conways_game_of_life, schelling, and virus_on_network models. With this change they are also integrated into the Mesa tutorial in the docs.
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.
9
69
 
10
- Also, in this release, visualizations are improved by making visualization elements scalable and more clearly labeling the plots.
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).
11
71
 
12
- <!-- Release notes generated using configuration in .github/release.yml at main -->
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.`
13
73
 
14
74
  ## What's Changed
15
75
  ### ⚠️ Breaking changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: Mesa
3
- Version: 3.0.0b1
3
+ Version: 3.0.0rc0
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'
@@ -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
@@ -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:
@@ -0,0 +1,47 @@
1
+ # Visualization
2
+
3
+ For a detailed tutorial, please refer to our [Visualization Tutorial](../tutorials/visualization_tutorial.ipynb).
4
+
5
+ ## Jupyter Visualization
6
+
7
+ ```{eval-rst}
8
+ .. automodule:: mesa.visualization.solara_viz
9
+ :members:
10
+ :undoc-members:
11
+ :show-inheritance:
12
+ ```
13
+
14
+ ## User Parameters
15
+
16
+ ```{eval-rst}
17
+ .. automodule:: mesa.visualization.UserParam
18
+ :members:
19
+ :undoc-members:
20
+ :show-inheritance:
21
+ ```
22
+
23
+
24
+ ## Matplotlib-based visualizations
25
+
26
+ ```{eval-rst}
27
+ .. automodule:: mesa.visualization.components.matplotlib_components
28
+ :members:
29
+ :undoc-members:
30
+ :show-inheritance:
31
+ ```
32
+
33
+ ```{eval-rst}
34
+ .. automodule:: mesa.visualization.mpl_space_drawing
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
38
+ ```
39
+
40
+ ## Altair-based visualizations
41
+
42
+ ```{eval-rst}
43
+ .. automodule:: mesa.visualization.components.altair_components
44
+ :members:
45
+ :undoc-members:
46
+ :show-inheritance:
47
+ ```
@@ -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,76 @@ 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 = [("basic", f.path) for f in os.scandir(osp.join(examples_folder, "basic")) if f.is_dir() and not f.name.startswith("__") ]
320
+ advanced_examples = [("advanced", 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
+ root_folder = pathlib.Path(os.path.join(HERE, "examples"))
327
+ root_folder.mkdir(parents=True, exist_ok=True)
328
+ pathlib.Path(os.path.join(root_folder, "basic")).mkdir(parents=True, exist_ok=True)
329
+ pathlib.Path(os.path.join(root_folder, "advanced")).mkdir(parents=True, exist_ok=True)
330
+
331
+ examples_md = []
332
+ for kind, example in examples:
333
+ base_name = os.path.basename(os.path.normpath(example))
334
+
335
+ agent_filename = os.path.join(example, "agents.py")
336
+ model_filename = os.path.join(example, "model.py")
337
+ readme_filename = os.path.join(example, "Readme.md")
338
+ app_filename = os.path.join(example, "app.py")
339
+
340
+ md_filename = f"{base_name}.md"
341
+ examples_md.append(base_name)
342
+
343
+ md_filepath = os.path.join(HERE, "examples", kind, md_filename)
344
+ write_example_md_file(agent_filename, model_filename, readme_filename, app_filename, md_filepath, template)
345
+
346
+ # create overview of examples.md
347
+ with open(os.path.join(HERE, "examples_overview_template.txt")) as fh:
348
+ template = string.Template(fh.read())
349
+
350
+ with open(os.path.join(examples_folder, "README.md")) as fh:
351
+ readme_md = fh.read()
352
+
353
+ with open(os.path.join(HERE, "examples.md"), "w") as fh:
354
+ content = template.substitute(
355
+ dict(
356
+ readme=readme_md,
357
+ # examples="\n".join([f"{' '.join(base_name.split('_'))} </examples/{base_name}>" for base_name in examples_md]),
358
+ )
359
+ )
360
+ fh.write(content)
361
+
362
+ def setup(app):
363
+ setup_examples_pages()
364
+
365
+ #
366
+ if __name__ == "__main__":
367
+ 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,3 @@
1
+
2
+ $readme
3
+
Binary file
@@ -0,0 +1,101 @@
1
+ # Mesa: Agent-based modeling in Python
2
+
3
+ ```{image} https://github.com/projectmesa/mesa/workflows/build/badge.svg
4
+ :target: https://github.com/projectmesa/mesa/actions
5
+ ```
6
+
7
+ ```{image} https://codecov.io/gh/projectmesa/mesa/branch/main/graph/badge.svg
8
+ :target: https://codecov.io/gh/projectmesa/mesa
9
+ ```
10
+
11
+ ```{image} https://img.shields.io/badge/code%20style-black-000000.svg
12
+ :target: https://github.com/psf/black
13
+ ```
14
+
15
+ ```{image} https://img.shields.io/matrix/project-mesa:matrix.org?label=chat&logo=Matrix
16
+ :target: https://matrix.to/#/#project-mesa:matrix.org
17
+ ```
18
+
19
+ [Mesa] is an Apache2 licensed agent-based modeling (or ABM) framework in Python.
20
+
21
+ Mesa allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python's data analysis tools. Its goal is to be the Python-based counterpart to NetLogo, Repast, or MASON.
22
+
23
+ ![A screenshot of the Wolf Sheep model in Mesa|100%](images/wolf_sheep.png)
24
+ *A visualisation of the Wolf Sheep model build with Mesa.*
25
+
26
+ ## Features
27
+
28
+ - Built-in core modeling components
29
+ - Flexible agent and model management through AgentSet
30
+ - Browser-based Solara visualization
31
+ - Built-in tools for data collection and analysis
32
+ - Example model library
33
+
34
+ ## Using Mesa
35
+ ### Installation Options
36
+
37
+ To install our latest stable release (2.4.x), run:
38
+
39
+ ```bash
40
+ pip install -U mesa
41
+ ```
42
+
43
+ To install our latest Mesa 3.0 beta with recommended dependencies:
44
+
45
+ ```bash
46
+ pip install -U --pre mesa[rec]
47
+ ```
48
+
49
+ ### Resources
50
+
51
+ For help getting started with Mesa, check out these resources:
52
+
53
+ - [Mesa Overview] - Learn about Mesa's core concepts and components
54
+ - [Mesa Introductory Tutorial] - Build your first agent-based model
55
+ - [Mesa Visualization Tutorial] - Learn how to create interactive visualizations with Solara
56
+ - [Migration Guide] - Upgrade to Mesa 3.0
57
+ - [Mesa Examples] - Browse user-contributed models and implementations
58
+ - [GitHub Discussions] - Ask questions and discuss Mesa
59
+ - [Matrix Chat Room] - Real-time chat with the Mesa community
60
+
61
+ ### Development and Support
62
+
63
+ Mesa is an open source project and welcomes contributions:
64
+
65
+ - [GitHub Repository] - Access the source code
66
+ - [Issue Tracker] - Report bugs or suggest features
67
+ - [Contributors Guide] - Learn how to contribute
68
+
69
+ The original Mesa conference paper is [available here](http://conference.scipy.org.s3-website-us-east-1.amazonaws.com/proceedings/scipy2015/jacqueline_kazil.html).
70
+
71
+ ```{toctree}
72
+ :hidden: true
73
+ :maxdepth: 7
74
+
75
+ Mesa Overview <overview>
76
+ tutorials/intro_tutorial
77
+ tutorials/visualization_tutorial
78
+ Examples <examples>
79
+ Migration guide <migration_guide>
80
+ Best Practices <best-practices>
81
+ API Documentation <apis/api_main>
82
+ Mesa Packages <packages>
83
+ ```
84
+
85
+ # Indices and tables
86
+
87
+ - {ref}`genindex`
88
+ - {ref}`modindex`
89
+ - {ref}`search`
90
+
91
+ [contributors guide]: https://github.com/projectmesa/mesa/blob/main/CONTRIBUTING.md
92
+ [github repository]: https://github.com/projectmesa/mesa/
93
+ [github discussions]: https://github.com/projectmesa/mesa/discussions
94
+ [issue tracker]: https://github.com/projectmesa/mesa/issues
95
+ [matrix chat room]: https://matrix.to/#/#project-mesa:matrix.org
96
+ [mesa]: https://github.com/projectmesa/mesa/
97
+ [mesa overview]: overview
98
+ [mesa examples]: https://github.com/projectmesa/mesa-examples
99
+ [mesa introductory tutorial]: tutorials/intro_tutorial
100
+ [mesa visualization tutorial]: tutorials/visualization_tutorial
101
+ [migration guide]: migration_guide
@@ -74,15 +74,32 @@ In Mesa 3.0, `unique_id` for agents is now automatically assigned, simplifying a
74
74
  1. Remove `unique_id` from agent initialization:
75
75
  ```python
76
76
  # Old
77
+ agent = MyAgent(unique_id=unique_id, model=self, ...)
78
+ agent = MyAgent(unique_id, self, ...)
77
79
  agent = MyAgent(self.next_id(), self, ...)
78
80
 
79
81
  # New
82
+ agent = MyAgent(model=self, ...)
80
83
  agent = MyAgent(self, ...)
81
84
  ```
82
- 2. `Model.next_id()` is deprecated and will always return 0. Remove any calls to this method.
83
- 3. `unique_id` is now unique relative to a Model instance and starts from 1.
84
- 4. If you previously used custom `unique_id` values, you'll need to store that information in a separate attribute.
85
- 5. Deprecation warning: Initializing an agent with two arguments (`unique_id` and `model`) will raise a warning. The `unique_id` argument will be ignored.
85
+
86
+ 2. Remove `unique_id` from Agent super() call:
87
+ ```python
88
+ # Old
89
+ class MyAgent(Agent):
90
+ def __init__(self, unique_id, model, ...):
91
+ super().__init__(unique_id, model)
92
+
93
+ # New
94
+ class MyAgent(Agent):
95
+ def __init__(self, model, ...):
96
+ super().__init__(model)
97
+ ```
98
+
99
+ 3. Important notes:
100
+ - `unique_id` is now automatically assigned relative to a Model instance and starts from 1
101
+ - `Model.next_id()` is removed
102
+ - If you previously used custom `unique_id` values, store that information in a separate attribute
86
103
 
87
104
  - Ref: [PR #2226](https://github.com/projectmesa/mesa/pull/2226), [PR #2260](https://github.com/projectmesa/mesa/pull/2260), Mesa-examples [PR #194](https://github.com/projectmesa/mesa-examples/pull/194), [Issue #2213](https://github.com/projectmesa/mesa/issues/2213)
88
105
 
@@ -236,6 +253,8 @@ Ref: Original discussion [#1912](https://github.com/projectmesa/mesa/discussions
236
253
  Mesa has adopted a new API for our frontend. If you already migrated to the experimental new SolaraViz you can still use
237
254
  the import from mesa.experimental. Otherwise here is a list of things you need to change.
238
255
 
256
+ > **Note:** SolaraViz is experimental and still in active development for Mesa 3.0. While we attempt to minimize them, there might be API breaking changes between Mesa 3.0 and 3.1. There won't be breaking changes between Mesa 3.0.x patch releases.
257
+
239
258
  #### Model Initialization
240
259
 
241
260
  Previously SolaraViz was initialized by providing a `model_cls` and a `model_params`. This has changed to expect a model instance `model`. You can still provide (user-settable) `model_params`, but only if users should be able to change them. It is now also possible to pass in a "reactive model" by first calling `model = solara.reactive(model)`. This is useful for notebook environments. It allows you to pass the model to the SolaraViz Module, but continue to use the model. For example calling `model.value.step()` (notice the extra .value) will automatically update the plots. This currently only automatically works for the step method, you can force visualization updates by calling `model.value.force_update()`.
@@ -251,9 +270,9 @@ from mesa.experimental import SolaraViz
251
270
  SolaraViz(model_cls, model_params, agent_portrayal=agent_portrayal)
252
271
 
253
272
  # new
254
- from mesa.visualization import SolaraViz, make_space_matplotlib
273
+ from mesa.visualization import SolaraViz, make_space_component
255
274
 
256
- SolaraViz(model, components=[make_space_matplotlib(agent_portrayal)])
275
+ SolaraViz(model, components=[make_space_component(agent_portrayal)])
257
276
  ```
258
277
 
259
278
  #### Plotting "measures"
@@ -264,15 +283,17 @@ SolaraViz(model, components=[make_space_matplotlib(agent_portrayal)])
264
283
  # old
265
284
  from mesa.experimental import SolaraViz
266
285
 
286
+
267
287
  def make_plot(model):
268
288
  ...
269
289
 
290
+
270
291
  SolaraViz(model_cls, model_params, measures=[make_plot, "foo", ["bar", "baz"]])
271
292
 
272
293
  # new
273
- from mesa.visualization import SolaraViz, make_plot_measure
294
+ from mesa.visualization import SolaraViz, make_plot_component
274
295
 
275
- SolaraViz(model, components=[make_plot, make_plot_measure("foo"), make_plot_measure("bar", "baz")])
296
+ SolaraViz(model, components=[make_plot, make_plot_component("foo"), make_plot_component("bar", "baz")])
276
297
  ```
277
298
 
278
299
  #### Plotting text