Mesa 3.1.0__tar.gz → 3.1.0.dev0__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 (194) hide show
  1. {mesa-3.1.0 → mesa-3.1.0.dev0}/.codespellignore +0 -1
  2. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/PULL_REQUEST_TEMPLATE/bug.md +5 -5
  3. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/PULL_REQUEST_TEMPLATE/feature.md +5 -5
  4. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/workflows/build_lint.yml +1 -1
  5. {mesa-3.1.0 → mesa-3.1.0.dev0}/.pre-commit-config.yaml +1 -1
  6. {mesa-3.1.0 → mesa-3.1.0.dev0}/Dockerfile +9 -8
  7. {mesa-3.1.0 → mesa-3.1.0.dev0}/HISTORY.md +0 -75
  8. {mesa-3.1.0 → mesa-3.1.0.dev0}/PKG-INFO +1 -1
  9. {mesa-3.1.0 → mesa-3.1.0.dev0}/codecov.yaml +1 -0
  10. {mesa-3.1.0 → mesa-3.1.0.dev0}/docker-compose.yml +1 -1
  11. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/apis/api_main.md +0 -1
  12. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/index.md +0 -4
  13. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/intro_tutorial.ipynb +79 -78
  14. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/__init__.py +3 -3
  15. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/agent.py +0 -48
  16. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/batchrunner.py +1 -14
  17. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/datacollection.py +6 -1
  18. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/epstein_civil_violence/app.py +0 -5
  19. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/pd_grid/app.py +0 -5
  20. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/sugarscape_g1mt/app.py +2 -7
  21. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boid_flockers/app.py +0 -5
  22. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boltzmann_wealth_model/app.py +5 -8
  23. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boltzmann_wealth_model/st_app.py +1 -1
  24. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/conways_game_of_life/app.py +0 -5
  25. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/conways_game_of_life/st_app.py +2 -2
  26. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/schelling/app.py +0 -5
  27. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/virus_on_network/app.py +0 -5
  28. mesa-3.1.0.dev0/mesa/experimental/UserParam.py +67 -0
  29. mesa-3.1.0.dev0/mesa/experimental/__init__.py +13 -0
  30. mesa-3.1.0.dev0/mesa/experimental/cell_space/__init__.py +38 -0
  31. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/cell_space/cell.py +37 -22
  32. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/cell_space/cell_agent.py +1 -12
  33. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/cell_space/cell_collection.py +3 -18
  34. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/cell_space/discrete_space.py +64 -15
  35. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/cell_space/grid.py +4 -74
  36. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/cell_space/network.py +1 -13
  37. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/cell_space/voronoi.py +1 -13
  38. mesa-3.1.0.dev0/mesa/experimental/components/altair.py +81 -0
  39. mesa-3.1.0.dev0/mesa/experimental/components/matplotlib.py +242 -0
  40. mesa-3.1.0.dev0/mesa/experimental/devs/__init__.py +6 -0
  41. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/devs/eventlist.py +1 -19
  42. mesa-3.1.0.dev0/mesa/experimental/devs/examples/epstein_civil_violence.py +305 -0
  43. mesa-3.1.0.dev0/mesa/experimental/devs/examples/wolf_sheep.py +250 -0
  44. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/experimental/devs/simulator.py +8 -24
  45. mesa-3.1.0.dev0/mesa/experimental/solara_viz.py +453 -0
  46. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/model.py +23 -17
  47. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/visualization/mpl_space_drawing.py +2 -2
  48. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/visualization/solara_viz.py +5 -23
  49. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_agent.py +0 -24
  50. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_batch_run.py +0 -31
  51. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_cell_space.py +59 -271
  52. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_components_matplotlib.py +1 -1
  53. mesa-3.1.0/docs/apis/mesa_logging.md +0 -7
  54. mesa-3.1.0/mesa/experimental/__init__.py +0 -20
  55. mesa-3.1.0/mesa/experimental/cell_space/__init__.py +0 -50
  56. mesa-3.1.0/mesa/experimental/cell_space/property_layer.py +0 -444
  57. mesa-3.1.0/mesa/experimental/devs/__init__.py +0 -24
  58. mesa-3.1.0/mesa/experimental/mesa_signals/__init__.py +0 -23
  59. mesa-3.1.0/mesa/experimental/mesa_signals/mesa_signal.py +0 -485
  60. mesa-3.1.0/mesa/experimental/mesa_signals/observable_collections.py +0 -133
  61. mesa-3.1.0/mesa/experimental/mesa_signals/signals_util.py +0 -52
  62. mesa-3.1.0/mesa/mesa_logging.py +0 -190
  63. mesa-3.1.0/tests/test_mesa_logging.py +0 -47
  64. mesa-3.1.0/tests/test_mesa_signals.py +0 -290
  65. {mesa-3.1.0 → mesa-3.1.0.dev0}/.coveragerc +0 -0
  66. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
  67. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  68. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  69. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/dependabot.yml +0 -0
  70. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/pull_request_template.md +0 -0
  71. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/release.yml +0 -0
  72. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/workflows/benchmarks.yml +0 -0
  73. {mesa-3.1.0 → mesa-3.1.0.dev0}/.github/workflows/release.yml +0 -0
  74. {mesa-3.1.0 → mesa-3.1.0.dev0}/.gitignore +0 -0
  75. {mesa-3.1.0 → mesa-3.1.0.dev0}/.readthedocs.yml +0 -0
  76. {mesa-3.1.0 → mesa-3.1.0.dev0}/CITATION.bib +0 -0
  77. {mesa-3.1.0 → mesa-3.1.0.dev0}/CODE_OF_CONDUCT.md +0 -0
  78. {mesa-3.1.0 → mesa-3.1.0.dev0}/CONTRIBUTING.md +0 -0
  79. {mesa-3.1.0 → mesa-3.1.0.dev0}/LICENSE +0 -0
  80. {mesa-3.1.0 → mesa-3.1.0.dev0}/NOTICE +0 -0
  81. {mesa-3.1.0 → mesa-3.1.0.dev0}/README.md +0 -0
  82. {mesa-3.1.0 → mesa-3.1.0.dev0}/benchmarks/compare_timings.py +0 -0
  83. {mesa-3.1.0 → mesa-3.1.0.dev0}/benchmarks/configurations.py +0 -0
  84. {mesa-3.1.0 → mesa-3.1.0.dev0}/benchmarks/global_benchmark.py +4 -4
  85. {mesa-3.1.0 → mesa-3.1.0.dev0}/binder/environment.yml +0 -0
  86. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/Makefile +0 -0
  87. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/README.md +0 -0
  88. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/_static/switcher.json +0 -0
  89. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/apis/agent.md +0 -0
  90. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/apis/batchrunner.md +0 -0
  91. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/apis/datacollection.md +0 -0
  92. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/apis/experimental.md +0 -0
  93. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/apis/model.md +0 -0
  94. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/apis/space.md +0 -0
  95. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/apis/visualization.md +0 -0
  96. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/best-practices.md +0 -0
  97. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/conf.py +0 -0
  98. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/example_template.txt +0 -0
  99. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/examples_overview_template.txt +0 -0
  100. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/getting_started.md +0 -0
  101. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/mesa_logo.ico +0 -0
  102. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/mesa_logo.png +0 -0
  103. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/br_ginis.png +0 -0
  104. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/dc_endwealth.png +0 -0
  105. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/dc_gini.png +0 -0
  106. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/dc_oneagent.png +0 -0
  107. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/first_hist.png +0 -0
  108. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/multirun_hist.png +0 -0
  109. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/numpy_grid.png +0 -0
  110. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/viz_chart.png +0 -0
  111. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/viz_empty.png +0 -0
  112. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/viz_greycircles.png +0 -0
  113. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/viz_histogram.png +0 -0
  114. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/tutorial/viz_redcircles.png +0 -0
  115. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/images/wolf_sheep.png +0 -0
  116. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/make.bat +0 -0
  117. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/mesa.md +0 -0
  118. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/migration_guide.md +0 -0
  119. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/MoneyModel.py +0 -0
  120. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/files/viz_chart.png +0 -0
  121. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/files/viz_empty.png +0 -0
  122. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/files/viz_greycircles.png +0 -0
  123. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/files/viz_histogram.png +0 -0
  124. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/files/viz_redcircles.png +0 -0
  125. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/files/viz_slider.png +0 -0
  126. {mesa-3.1.0 → mesa-3.1.0.dev0}/docs/tutorials/visualization_tutorial.ipynb +0 -0
  127. {mesa-3.1.0 → mesa-3.1.0.dev0}/maintenance/fetch_unlabeled_prs.py +0 -0
  128. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/README.md +0 -0
  129. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/__init__.py +2 -2
  130. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/__init__.py +0 -0
  131. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +0 -0
  132. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/epstein_civil_violence/Readme.md +0 -0
  133. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/epstein_civil_violence/__init__.py +0 -0
  134. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/epstein_civil_violence/agents.py +0 -0
  135. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/epstein_civil_violence/model.py +0 -0
  136. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/pd_grid/Readme.md +0 -0
  137. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/pd_grid/__init__.py +0 -0
  138. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/pd_grid/agents.py +0 -0
  139. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/pd_grid/analysis.ipynb +0 -0
  140. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/pd_grid/model.py +0 -0
  141. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/sugarscape_g1mt/Readme.md +0 -0
  142. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/sugarscape_g1mt/__init__.py +0 -0
  143. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/sugarscape_g1mt/agents.py +0 -0
  144. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/sugarscape_g1mt/model.py +0 -0
  145. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/sugarscape_g1mt/sugar-map.txt +0 -0
  146. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/sugarscape_g1mt/tests.py +0 -0
  147. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/wolf_sheep/Readme.md +0 -0
  148. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/wolf_sheep/__init__.py +0 -0
  149. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/wolf_sheep/agents.py +0 -0
  150. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/wolf_sheep/app.py +0 -0
  151. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/advanced/wolf_sheep/model.py +0 -0
  152. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/__init__.py +0 -0
  153. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boid_flockers/Readme.md +0 -0
  154. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boid_flockers/__init__.py +0 -0
  155. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boid_flockers/agents.py +0 -0
  156. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boid_flockers/model.py +0 -0
  157. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boltzmann_wealth_model/Readme.md +0 -0
  158. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
  159. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boltzmann_wealth_model/agents.py +0 -0
  160. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/boltzmann_wealth_model/model.py +0 -0
  161. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/conways_game_of_life/Readme.md +0 -0
  162. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/conways_game_of_life/__init__.py +0 -0
  163. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/conways_game_of_life/agents.py +0 -0
  164. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/conways_game_of_life/model.py +0 -0
  165. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/schelling/Readme.md +0 -0
  166. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/schelling/__init__.py +0 -0
  167. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/schelling/agents.py +0 -0
  168. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/schelling/analysis.ipynb +0 -0
  169. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/schelling/model.py +0 -0
  170. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/virus_on_network/Readme.md +0 -0
  171. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/virus_on_network/__init__.py +0 -0
  172. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/virus_on_network/agents.py +0 -0
  173. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/examples/basic/virus_on_network/model.py +0 -0
  174. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/space.py +0 -0
  175. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/visualization/__init__.py +2 -2
  176. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/visualization/components/__init__.py +0 -0
  177. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/visualization/components/altair_components.py +0 -0
  178. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/visualization/components/matplotlib_components.py +0 -0
  179. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/visualization/user_param.py +0 -0
  180. {mesa-3.1.0 → mesa-3.1.0.dev0}/mesa/visualization/utils.py +0 -0
  181. {mesa-3.1.0 → mesa-3.1.0.dev0}/mypy.ini +0 -0
  182. {mesa-3.1.0 → mesa-3.1.0.dev0}/pyproject.toml +0 -0
  183. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/__init__.py +0 -0
  184. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/read_requirements.py +0 -0
  185. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_datacollector.py +0 -0
  186. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_devs.py +0 -0
  187. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_end_to_end_viz.sh +0 -0
  188. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_examples.py +0 -0
  189. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_grid.py +0 -0
  190. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_import_namespace.py +0 -0
  191. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_lifespan.py +0 -0
  192. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_model.py +0 -0
  193. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_solara_viz.py +0 -0
  194. {mesa-3.1.0 → mesa-3.1.0.dev0}/tests/test_space.py +0 -0
@@ -7,4 +7,3 @@ ue
7
7
  fpr
8
8
  falsy
9
9
  assertIn
10
- nD
@@ -1,16 +1,16 @@
1
- ### Summary
1
+ ## Summary
2
2
  <!-- Provide a brief summary of the bug and its impact. -->
3
3
 
4
- ### Bug / Issue
4
+ ## Bug / Issue
5
5
  <!-- Link to the related issue(s) and describe the bug. Include details like the context, what was expected, and what actually happened. -->
6
6
 
7
- ### Implementation
7
+ ## Implementation
8
8
  <!-- Describe the changes made to resolve the issue. Highlight any important parts of the code that were modified. -->
9
9
 
10
- ### Testing
10
+ ## Testing
11
11
  <!-- Detail the testing performed to verify the fix. Include information on test cases, steps taken, and any relevant results.
12
12
 
13
13
  If you're fixing the visualisation, add before/after screenshots. -->
14
14
 
15
- ### Additional Notes
15
+ ## Additional Notes
16
16
  <!-- Add any additional information that may be relevant for the reviewers, such as potential side effects, dependencies, or related work.
@@ -1,16 +1,16 @@
1
- ### Summary
1
+ ## Summary
2
2
  <!-- Provide a concise summary of the feature and its purpose. -->
3
3
 
4
- ### Motive
4
+ ## Motive
5
5
  <!-- Explain the reasoning behind this feature. Include details on the problem it addresses or the enhancement it provides. -->
6
6
 
7
- ### Implementation
7
+ ## Implementation
8
8
  <!-- Describe how the feature was implemented. Include details on the approach taken, important decisions made, and code changes. -->
9
9
 
10
- ### Usage Examples
10
+ ## Usage Examples
11
11
  <!-- Provide code snippets or examples demonstrating how to use the new feature. Highlight key scenarios where this feature will be beneficial.
12
12
 
13
13
  If you're modifying the visualisation, add before/after screenshots. -->
14
14
 
15
- ### Additional Notes
15
+ ## Additional Notes
16
16
  <!-- Add any additional information that may be relevant for the reviewers, such as potential side effects, dependencies, or related work. -->
@@ -57,7 +57,7 @@ jobs:
57
57
  run: pytest --durations=10 --cov=mesa tests/ --cov-report=xml
58
58
  - if: matrix.os == 'ubuntu'
59
59
  name: Codecov
60
- uses: codecov/codecov-action@v5
60
+ uses: codecov/codecov-action@v4
61
61
  with:
62
62
  fail_ci_if_error: true
63
63
  token: ${{ secrets.CODECOV_TOKEN }}
@@ -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.8.1
7
+ rev: v0.7.2
8
8
  hooks:
9
9
  # Run the linter.
10
10
  - id: ruff
@@ -1,12 +1,14 @@
1
1
  # We can't use slim because we need either git/wget/curl to
2
2
  # download mesa-examples, and so installing them requires
3
3
  # updating the system anyway.
4
+ # We can't use alpine because NumPy doesn't support musllinux yet.
5
+ # But it's in the RC version https://github.com/numpy/numpy/issues/20089.
4
6
  FROM python:bookworm
5
- LABEL maintainer="projectmesa maintainers@projectmesa.dev"
7
+ LABEL maintainer="rht <rhtbot@protonmail.com>"
6
8
 
7
9
  # To use this Dockerfile:
8
- # 1. `docker build . -t mesa_image`
9
- # 2. `docker run --name mesa_instance -p 8765:8765 -it mesa_image`
10
+ # 1. `docker build . -t mymesa_image`
11
+ # 2. `docker run --name mymesa_instance -p 8765:8765 -it mymesa_image`
10
12
  # 3. In your browser, visit http://127.0.0.1:8765
11
13
  #
12
14
  # Currently, this Dockerfile defaults to running the Schelling model, as an
@@ -17,7 +19,7 @@ LABEL maintainer="projectmesa maintainers@projectmesa.dev"
17
19
  # `docker run --name mymesa_instance -p 8765:8765 -e MODEL_DIR=/mesa-examples/examples/sugarscape_cg -it mymesa_image`
18
20
  # Note: the model directory MUST contain an app.py file.
19
21
 
20
- ENV MODEL_DIR=/opt/mesa/mesa/examples/basic/schelling
22
+ ENV MODEL_DIR=/mesa-examples/examples/schelling_experimental
21
23
 
22
24
  # Don't buffer output:
23
25
  # https://docs.python.org/3.10/using/cmdline.html?highlight=pythonunbuffered#envvar-PYTHONUNBUFFERED
@@ -27,11 +29,10 @@ WORKDIR /opt/mesa
27
29
 
28
30
  COPY . /opt/mesa
29
31
 
32
+ RUN cd / && git clone https://github.com/projectmesa/mesa-examples.git
33
+
30
34
  EXPOSE 8765/tcp
31
35
 
32
- RUN pip3 install -e /opt/mesa[rec]
36
+ RUN pip3 install -e /opt/mesa
33
37
 
34
38
  CMD ["sh", "-c", "cd $MODEL_DIR && solara run app.py --host=0.0.0.0"]
35
-
36
- # To check file system:
37
- # docker exec -it mesa_instance bash
@@ -1,81 +1,6 @@
1
1
  ---
2
2
  title: Release History
3
3
  ---
4
- # 3.1.0 (2024-12-04)
5
- ## Highlights
6
- With Mesa 3.1.0 we're back on our regular release schedule after the big Mesa 3.0 release, with some exciting new features.
7
-
8
- This release adds experimental support for Observables and Computed, enabling a more reactive and responsive programming model for agent-based simulations. The new `Observable` and `Computable` classes allow developers to declaratively define attributes that automatically emit signals when their values change, and compute derived values that update dynamically. This lays the groundwork for more advanced event handling and data visualization features in future releases (#2291).
9
-
10
- The experimental cell space module has been updated with full support for n-dimensional property layers. These allow agents to easily interact with and modify spatial properties of the environment, such as terrain, resources, or environmental conditions. The new implementation provides a more intuitive attribute-based API and ensures tight integration with the cell space architecture (#2512).
11
-
12
- Mesa now includes built-in support for logging using the standard Python `logging` module. This provides developers with a flexible and powerful way to add structured diagnostic and debug output to their simulations, without the need for custom logging solutions. The logging system is integrated throughout the library, including the new SolaraViz visualization system (#2506).
13
-
14
- Creating multiple agents with varying initialization parameters is now significantly easier with the new `Agent.create_agents` class method. This factory function supports both uniform and per-agent parameters, simplifying the code required to set up a simulation with a large number of heterogeneous agents (#2351).
15
-
16
- In addition to the major new features, this release includes a number of smaller enhancements and bug fixes that improve the overall developer experience. These include removing deprecated functionality, cleaning up examples, and addressing various edge cases reported by the community. Mesa 3.1 requires Python 3.11 or higher.
17
-
18
- ## What's Changed
19
- ### 🧪 Experimental features
20
- * Add support for Observables to MESA by @quaquel in https://github.com/projectmesa/mesa/pull/2291
21
- * Add full support for property layers to cell spaces by @quaquel in https://github.com/projectmesa/mesa/pull/2512
22
- ### 🎉 New features added
23
- * Add logging to MESA by @quaquel in https://github.com/projectmesa/mesa/pull/2506
24
- * Add `create_agents` factory method to Agent by @quaquel in https://github.com/projectmesa/mesa/pull/2351
25
- ### 🔍 Examples updated
26
- * Add seed control to all examples by @quaquel in https://github.com/projectmesa/mesa/pull/2496
27
- ### 📜 Documentation improvements
28
- * doc fix for pip install error on mac by @quaquel in https://github.com/projectmesa/mesa/pull/2508
29
- * Refactored docs for Introductory Tutorial by @Spartan-71 in https://github.com/projectmesa/mesa/pull/2511
30
- * Add module-level docstring to experimental features by @EwoutH in https://github.com/projectmesa/mesa/pull/2532
31
- ### 🔧 Maintenance
32
- * Remove deprecated time module by @EwoutH in https://github.com/projectmesa/mesa/pull/2476
33
- * Drop support for Python 3.10, require Python >= 3.11 by @EwoutH in https://github.com/projectmesa/mesa/pull/2474
34
- * Remove deprecated functionality by @EwoutH in https://github.com/projectmesa/mesa/pull/2483
35
- * Remove visualization modules from `mesa.experimental` by @quaquel in https://github.com/projectmesa/mesa/pull/2495
36
- * Cleanup two occurrences of removed scheduler by @EwoutH in https://github.com/projectmesa/mesa/pull/2499
37
- * move _setup_agent_registration into `Model.__init__` by @quaquel in https://github.com/projectmesa/mesa/pull/2501
38
- * remove devs related examples from devs/examples by @quaquel in https://github.com/projectmesa/mesa/pull/2507
39
- * added empty iterable checks and updated tests by @Sahil-Chhoker in https://github.com/projectmesa/mesa/pull/2523
40
- * Fix: running Mesa in Docker with Schelling model by @AdamZh0u in https://github.com/projectmesa/mesa/pull/2524
41
-
42
- ## New Contributors
43
- * @Spartan-71 made their first contribution in https://github.com/projectmesa/mesa/pull/2511
44
- * @Sahil-Chhoker made their first contribution in https://github.com/projectmesa/mesa/pull/2523
45
- * @AdamZh0u made their first contribution in https://github.com/projectmesa/mesa/pull/2524
46
-
47
- **Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.3...v3.1.0
48
-
49
- # 3.0.3 (2024-11-14)
50
- ## Highlights
51
- A small bugfix release that fixes two bugs.
52
-
53
- ## What's Changed
54
- ### 🧪 Experimental features
55
- * cell_space: Allow CellCollection to be empty by @EwoutH in https://github.com/projectmesa/mesa/pull/2502
56
- ### 🐛 Bugs fixed
57
- * Only set model_parameters once by @Corvince in https://github.com/projectmesa/mesa/pull/2505
58
-
59
- **Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.2...v3.0.3
60
-
61
- # 3.0.2 (2024-11-11)
62
- ## Highlighst
63
- Mesa 3.0.2 is a small follow-up patch release, in which we fixed a lot of small bugs in the example models their visualisation, and improved their testing.
64
-
65
- ## What's Changed
66
- ### 🐛 Bugs fixed
67
- * allow components as a positional argument again by @Corvince in https://github.com/projectmesa/mesa/pull/2488
68
- ### 🔍 Examples updated
69
- * examples: Add required components keyword by @EwoutH in https://github.com/projectmesa/mesa/pull/2485
70
- * examples: Fix boid_flockers viz by @EwoutH in https://github.com/projectmesa/mesa/pull/2492
71
- * examples: Fix schelling viz by @EwoutH in https://github.com/projectmesa/mesa/pull/2490
72
- * example: Add input sliders to Sugerscape viz by @EwoutH in https://github.com/projectmesa/mesa/pull/2487
73
- * examples/gol: Add initial fraction alive, add sliders to viz by @EwoutH in https://github.com/projectmesa/mesa/pull/2489
74
- ### 🔧 Maintenance
75
- * test app init of examples by @Corvince in https://github.com/projectmesa/mesa/pull/2491
76
-
77
- **Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.1...v3.0.2
78
-
79
4
  # 3.0.1 (2024-11-11)
80
5
  ## Highlights
81
6
  After our huge [3.0.0 release](https://github.com/projectmesa/mesa/releases/tag/v3.0.0), Mesa 3.0.1 follows up with two improvements to experimental features, examples and docs.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: Mesa
3
- Version: 3.1.0
3
+ Version: 3.1.0.dev0
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
@@ -7,6 +7,7 @@ coverage:
7
7
 
8
8
  ignore:
9
9
  - "benchmarks/**"
10
+ - "mesa/experimental/**"
10
11
  - "mesa/visualization/**"
11
12
 
12
13
  comment: off
@@ -16,6 +16,6 @@ services:
16
16
  # within the current directory.
17
17
  # E.g. if it is at my-model, then you specify it as
18
18
  # /opt/mesa/my-model.
19
- MODEL_DIR: /opt/mesa/mesa/examples/basic/schelling
19
+ MODEL_DIR: /mesa-examples/examples/schelling_experimental
20
20
  ports:
21
21
  - 8765:8765
@@ -10,6 +10,5 @@ space
10
10
  datacollection
11
11
  batchrunner
12
12
  visualization
13
- logging
14
13
  experimental
15
14
  ```
@@ -43,10 +43,6 @@ To also install our recommended dependencies:
43
43
  pip install -U mesa[rec]
44
44
  ```
45
45
 
46
- On a Mac, this command might cause an error stating `zsh: no matches found: mesa[all]`.
47
- In that case, change the command to `pip install -U "mesa[rec]"`.
48
-
49
-
50
46
  To install our latest pre-release:
51
47
 
52
48
  ```bash
@@ -294,17 +294,15 @@
294
294
  " def __init__(self, n, seed=None):\n",
295
295
  " super().__init__(seed=seed)\n",
296
296
  " self.num_agents = n\n",
297
- "\n",
297
+ " \n",
298
298
  " # Create agents\n",
299
299
  " for _ in range(self.num_agents):\n",
300
- " a = MoneyAgent(\n",
301
- " self\n",
302
- " ) # This calls the agent class parameter n number of times\n",
300
+ " a = MoneyAgent(self) # This calls the agent class parameter n number of times \n",
303
301
  "\n",
304
302
  " def step(self):\n",
305
303
  " \"\"\"Advance the model by one step.\"\"\"\n",
306
304
  "\n",
307
- " # This function psuedo-randomly reorders the list of agent objects and\n",
305
+ " # This function psuedo-randomly reorders the list of agent objects and \n",
308
306
  " # then iterates through calling the function passed in as the parameter\n",
309
307
  " self.agents.shuffle_do(\"say_hi\")"
310
308
  ]
@@ -469,24 +467,21 @@
469
467
  " other_agent.wealth += 1\n",
470
468
  " self.wealth -= 1\n",
471
469
  "\n",
472
- "\n",
473
470
  "class MoneyModel(mesa.Model):\n",
474
471
  " \"\"\"A model with some number of agents.\"\"\"\n",
475
472
  "\n",
476
473
  " def __init__(self, n):\n",
477
474
  " super().__init__()\n",
478
475
  " self.num_agents = n\n",
479
- "\n",
476
+ " \n",
480
477
  " # Create agents\n",
481
478
  " for _ in range(self.num_agents):\n",
482
- " a = MoneyAgent(\n",
483
- " self\n",
484
- " ) # This calls the agent class parameter n number of times\n",
479
+ " a = MoneyAgent(self) # This calls the agent class parameter n number of times \n",
485
480
  "\n",
486
481
  " def step(self):\n",
487
482
  " \"\"\"Advance the model by one step.\"\"\"\n",
488
483
  "\n",
489
- " # This function psuedo-randomly reorders the list of agent objects and\n",
484
+ " # This function psuedo-randomly reorders the list of agent objects and \n",
490
485
  " # then iterates through calling the function passed in as the parameter\n",
491
486
  " self.agents.shuffle_do(\"exchange\")"
492
487
  ]
@@ -514,10 +509,8 @@
514
509
  "metadata": {},
515
510
  "outputs": [],
516
511
  "source": [
517
- "model = MoneyModel(10) # Tells the model to create 10 agents\n",
518
- "for _ in range(\n",
519
- " 30\n",
520
- "): # Runs the model for 10 steps; an underscore is common convention for a variable that is not used\n",
512
+ "model = MoneyModel(10) # Tels the model to create 10 agents\n",
513
+ "for _ in range(30): #Runs the model for 10 steps; an underscore is common convention for a variable that is not used\n",
521
514
  " model.step()"
522
515
  ]
523
516
  },
@@ -672,16 +665,23 @@
672
665
  " #...\n",
673
666
  " def give_money(self):\n",
674
667
  " cellmates = self.model.grid.get_cell_list_contents([self.pos])\n",
675
- " # Ensure agent is not giving money to itself\n",
676
- " cellmates.pop(\n",
677
- " cellmates.index(self)\n",
678
- " )\n",
679
- " if len(cellmates) > 0:\n",
668
+ " if len(cellmates) > 1:\n",
680
669
  " other = self.random.choice(cellmates)\n",
681
670
  " other.wealth += 1\n",
682
671
  " self.wealth -= 1\n",
683
672
  "```\n",
684
673
  "\n",
674
+ "And with those two methods, the agent's ``step`` method becomes:\n",
675
+ "\n",
676
+ "```python\n",
677
+ "class MoneyAgent(mesa.Agent):\n",
678
+ " # ...\n",
679
+ " def step(self):\n",
680
+ " self.move()\n",
681
+ " if self.wealth > 0:\n",
682
+ " self.give_money()\n",
683
+ "```\n",
684
+ "\n",
685
685
  "Now, putting that all together should look like this:"
686
686
  ]
687
687
  },
@@ -706,23 +706,22 @@
706
706
  " self.model.grid.move_agent(self, new_position)\n",
707
707
  "\n",
708
708
  " def give_money(self):\n",
709
- " cellmates = self.model.grid.get_cell_list_contents([self.pos])\n",
710
- " # Ensure agent is not giving money to itself\n",
711
- " cellmates.pop(cellmates.index(self))\n",
712
- " if len(cellmates) > 0:\n",
713
- " other_agent = self.random.choice(cellmates)\n",
714
- " other_agent.wealth += 1\n",
715
- " self.wealth -= 1\n",
716
- "\n",
709
+ " if self.wealth > 0: \n",
710
+ " cellmates = self.model.grid.get_cell_list_contents([self.pos])\n",
711
+ " if len(cellmates) > 1:\n",
712
+ " other_agent = self.random.choice(cellmates)\n",
713
+ " other_agent.wealth += 1\n",
714
+ " self.wealth -= 1\n",
717
715
  "\n",
716
+ " \n",
718
717
  "class MoneyModel(mesa.Model):\n",
719
718
  " \"\"\"A model with some number of agents.\"\"\"\n",
720
719
  "\n",
721
- " def __init__(self, n, width, height, seed=None):\n",
720
+ " def __init__(self, n, width, height,seed=None):\n",
722
721
  " super().__init__(seed=seed)\n",
723
722
  " self.num_agents = n\n",
724
723
  " self.grid = mesa.space.MultiGrid(width, height, True)\n",
725
- "\n",
724
+ " \n",
726
725
  " # Create agents\n",
727
726
  " for _ in range(self.num_agents):\n",
728
727
  " a = MoneyAgent(self)\n",
@@ -733,7 +732,7 @@
733
732
  "\n",
734
733
  " def step(self):\n",
735
734
  " self.agents.shuffle_do(\"move\")\n",
736
- " self.agents.do(\"give_money\")"
735
+ " self.agents.shuffle_do(\"give_money\")"
737
736
  ]
738
737
  },
739
738
  {
@@ -792,7 +791,7 @@
792
791
  "metadata": {},
793
792
  "outputs": [],
794
793
  "source": [
795
- "# Challenge: Change from multigrid to grid (only one agent per cell)"
794
+ "# Challenge: Change from multigrid to grid (only one agent per cell) "
796
795
  ]
797
796
  },
798
797
  {
@@ -846,13 +845,22 @@
846
845
  "\n",
847
846
  " def give_money(self):\n",
848
847
  " cellmates = self.model.grid.get_cell_list_contents([self.pos])\n",
849
- " # Ensure agent is not giving money to itself\n",
850
- " cellmates.pop(cellmates.index(self))\n",
851
- " if len(cellmates) > 0:\n",
848
+ " cellmates.pop(\n",
849
+ " cellmates.index(self)\n",
850
+ " ) # Ensure agent is not giving money to itself\n",
851
+ " if len(cellmates) > 1:\n",
852
852
  " other = self.random.choice(cellmates)\n",
853
853
  " other.wealth += 1\n",
854
854
  " self.wealth -= 1\n",
855
- " \n",
855
+ " if other == self:\n",
856
+ " print(\"I JUST GAVE MOnEY TO MYSELF HEHEHE!\")\n",
857
+ "\n",
858
+ " # There are several ways in which one can combine functions to execute the model\n",
859
+ " def agent_act(self): \n",
860
+ " self.move()\n",
861
+ " if self.wealth > 0:\n",
862
+ " self.give_money()\n",
863
+ "\n",
856
864
  "\n",
857
865
  "class MoneyModel(mesa.Model):\n",
858
866
  " \"\"\"A model with some number of agents.\"\"\"\n",
@@ -875,10 +883,10 @@
875
883
  " y = self.random.randrange(self.grid.height)\n",
876
884
  " self.grid.place_agent(a, (x, y))\n",
877
885
  "\n",
886
+ " \n",
878
887
  " def step(self):\n",
879
888
  " self.datacollector.collect(self)\n",
880
- " self.agents.shuffle_do(\"move\")\n",
881
- " self.agents.do(\"give_money\")"
889
+ " self.agents.shuffle_do(\"agent_act\")"
882
890
  ]
883
891
  },
884
892
  {
@@ -1118,24 +1126,22 @@
1118
1126
  " self.model.grid.move_agent(self, new_position)\n",
1119
1127
  "\n",
1120
1128
  " def give_money(self):\n",
1121
- " if self.wealth > 0:\n",
1129
+ " if self.wealth > 0: \n",
1122
1130
  " cellmates = self.model.grid.get_cell_list_contents([self.pos])\n",
1123
- " # Ensure agent is not giving money to itself\n",
1124
- " cellmates.pop(cellmates.index(self))\n",
1125
- " if len(cellmates) > 0:\n",
1131
+ " if len(cellmates) > 1:\n",
1126
1132
  " other_agent = self.random.choice(cellmates)\n",
1127
1133
  " other_agent.wealth += 1\n",
1128
1134
  " self.wealth -= 1\n",
1129
- "\n",
1135
+ " \n",
1130
1136
  "\n",
1131
1137
  "class MoneyModel(mesa.Model):\n",
1132
1138
  " \"\"\"A model with some number of agents.\"\"\"\n",
1133
1139
  "\n",
1134
- " def __init__(self, n, width, height, seed=None):\n",
1140
+ " def __init__(self, n, width, height,seed=None):\n",
1135
1141
  " super().__init__(seed=seed)\n",
1136
1142
  " self.num_agents = n\n",
1137
1143
  " self.grid = mesa.space.MultiGrid(width, height, True)\n",
1138
- "\n",
1144
+ " \n",
1139
1145
  " # Create agents\n",
1140
1146
  " for _ in range(self.num_agents):\n",
1141
1147
  " a = MoneyAgent(self)\n",
@@ -1220,11 +1226,11 @@
1220
1226
  " self.wealth = 1\n",
1221
1227
  "\n",
1222
1228
  " def give_money(self, poor_agents):\n",
1223
- " if self.wealth > 0:\n",
1229
+ " if self.wealth > 0: \n",
1224
1230
  " other_agent = self.random.choice(poor_agents)\n",
1225
1231
  " other_agent.wealth += 1\n",
1226
1232
  " self.wealth -= 1\n",
1227
- "\n",
1233
+ " \n",
1228
1234
  "\n",
1229
1235
  "class MoneyModel(mesa.Model):\n",
1230
1236
  " \"\"\"A model with some number of agents.\"\"\"\n",
@@ -1232,7 +1238,7 @@
1232
1238
  " def __init__(self, n):\n",
1233
1239
  " super().__init__()\n",
1234
1240
  " self.num_agents = n\n",
1235
- "\n",
1241
+ " \n",
1236
1242
  " # Create agents\n",
1237
1243
  " for _ in range(self.num_agents):\n",
1238
1244
  " a = MoneyAgent(self)\n",
@@ -1240,17 +1246,17 @@
1240
1246
  " self.datacollector = mesa.DataCollector(\n",
1241
1247
  " model_reporters={\"Gini\": compute_gini}, agent_reporters={\"Wealth\": \"wealth\"}\n",
1242
1248
  " )\n",
1243
- "\n",
1249
+ " \n",
1244
1250
  " def step(self):\n",
1245
1251
  " self.datacollector.collect(self)\n",
1246
1252
  " # Get lists of rich and poor agents\n",
1247
1253
  " rich_agents = model.agents.select(lambda a: a.wealth >= 3)\n",
1248
1254
  " poor_agents = model.agents.select(lambda a: a.wealth < 3)\n",
1249
1255
  " # When there is rich agents only have them give money to the poor agents\n",
1250
- " if len(rich_agents) > 0:\n",
1256
+ " if len(rich_agents) > 0: \n",
1251
1257
  " rich_agents.shuffle_do(\"give_money\", poor_agents)\n",
1252
- " else:\n",
1253
- " poor_agents.shuffle_do(\"give_money\", poor_agents)"
1258
+ " else: \n",
1259
+ " poor_agents.shuffle_do(\"give_money\", poor_agents) "
1254
1260
  ]
1255
1261
  },
1256
1262
  {
@@ -1268,7 +1274,7 @@
1268
1274
  "source": [
1269
1275
  "model = MoneyModel(100)\n",
1270
1276
  "for _ in range(20):\n",
1271
- " model.step()\n",
1277
+ " model.step() \n",
1272
1278
  "\n",
1273
1279
  "\n",
1274
1280
  "data = model.datacollector.get_agent_vars_dataframe()\n",
@@ -1303,11 +1309,11 @@
1303
1309
  " self.ethnicity = ethnicity\n",
1304
1310
  "\n",
1305
1311
  " def give_money(self, similars):\n",
1306
- " if self.wealth > 0:\n",
1312
+ " if self.wealth > 0: \n",
1307
1313
  " other_agent = self.random.choice(similars)\n",
1308
1314
  " other_agent.wealth += 1\n",
1309
1315
  " self.wealth -= 1\n",
1310
- "\n",
1316
+ " \n",
1311
1317
  "\n",
1312
1318
  "class MoneyModel(mesa.Model):\n",
1313
1319
  " \"\"\"A model with some number of agents.\"\"\"\n",
@@ -1315,31 +1321,29 @@
1315
1321
  " def __init__(self, n):\n",
1316
1322
  " super().__init__()\n",
1317
1323
  " self.num_agents = n\n",
1318
- "\n",
1324
+ " \n",
1319
1325
  " # Create a list of our different ethnicities\n",
1320
1326
  " ethnicities = [\"Green\", \"Blue\", \"Mixed\"]\n",
1321
- "\n",
1327
+ " \n",
1322
1328
  " # Create agents\n",
1323
1329
  " for _ in range(self.num_agents):\n",
1324
1330
  " a = MoneyAgent(self, self.random.choice(ethnicities))\n",
1325
1331
  "\n",
1326
1332
  " self.datacollector = mesa.DataCollector(\n",
1327
- " model_reporters={\"Gini\": compute_gini},\n",
1328
- " agent_reporters={\"Wealth\": \"wealth\", \"Ethnicity\": \"ethnicity\"},\n",
1333
+ " model_reporters={\"Gini\": compute_gini}, agent_reporters={\"Wealth\": \"wealth\", \"Ethnicity\":\"ethnicity\"}\n",
1329
1334
  " )\n",
1330
- "\n",
1335
+ " \n",
1331
1336
  " def step(self):\n",
1332
1337
  " self.datacollector.collect(self)\n",
1333
1338
  " # groupby returns a dictionary of the different ethnicities with a list of agents\n",
1334
1339
  " grouped_agents = model.agents.groupby(\"ethnicity\")\n",
1335
1340
  "\n",
1336
- " for ethnic, similars in grouped_agents:\n",
1337
- " if ethnic != \"Mixed\":\n",
1341
+ " for ethnic, similars in grouped_agents: \n",
1342
+ " if ethnic != \"Mixed\": \n",
1338
1343
  " similars.shuffle_do(\"give_money\", similars)\n",
1339
- " else:\n",
1340
- " similars.shuffle_do(\n",
1341
- " \"give_money\", self.agents\n",
1342
- " ) # This allows mixed to trade with anyone"
1344
+ " else: \n",
1345
+ " similars.shuffle_do(\"give_money\", self.agents) # This allows mixed to trade with anyone \n",
1346
+ "\n"
1343
1347
  ]
1344
1348
  },
1345
1349
  {
@@ -1352,12 +1356,12 @@
1352
1356
  "model = MoneyModel(100)\n",
1353
1357
  "for _ in range(20):\n",
1354
1358
  " model.step()\n",
1355
- "\n",
1359
+ " \n",
1356
1360
  "# get the data\n",
1357
1361
  "data = model.datacollector.get_agent_vars_dataframe()\n",
1358
1362
  "# assign histogram colors\n",
1359
- "palette = {\"Green\": \"green\", \"Blue\": \"blue\", \"Mixed\": \"purple\"}\n",
1360
- "sns.histplot(data=data, x=\"Wealth\", hue=\"Ethnicity\", discrete=True, palette=palette)\n",
1363
+ "palette = {'Green': 'green', 'Blue': 'blue', 'Mixed': 'purple'} \n",
1364
+ "sns.histplot(data=data, x='Wealth', hue='Ethnicity',discrete=True, palette=palette)\n",
1361
1365
  "g.set(title=\"Wealth distribution\", xlabel=\"Wealth\", ylabel=\"number of agents\");"
1362
1366
  ]
1363
1367
  },
@@ -1441,8 +1445,7 @@
1441
1445
  "\n",
1442
1446
  " def give_money(self):\n",
1443
1447
  " cellmates = self.model.grid.get_cell_list_contents([self.pos])\n",
1444
- " cellmates.pop(cellmates.index(self))\n",
1445
- " if len(cellmates) > 0 and self.wealth > 0:\n",
1448
+ " if len(cellmates) > 1 and self.wealth > 0:\n",
1446
1449
  " other = self.random.choice(cellmates)\n",
1447
1450
  " other.wealth += 1\n",
1448
1451
  " self.wealth -= 1\n",
@@ -1495,9 +1498,7 @@
1495
1498
  {
1496
1499
  "cell_type": "markdown",
1497
1500
  "metadata": {},
1498
- "source": [
1499
- "**note for Windows OS users:** If you are running this tutorial in Jupyter, make sure that you set `number_processes = 1` (single process). If `number_processes` is greater than 1, it is less straightforward to set up. For details on how to use multiprocessing on windows, see [multiprocessing's programming guidelines](https://docs.python.org/3/library/multiprocessing.html#multiprocessing-programming). "
1500
- ]
1501
+ "source": "**note for Windows OS users:** If you are running this tutorial in Jupyter, make sure that you set `number_processes = 1` (single process). If `number_processes` is greater than 1, it is less straightforward to set up. For details on how to use multiprocessing on windows, see [multiprocessing's programming guidelines](https://docs.python.org/3/library/multiprocessing.html#multiprocessing-programming). "
1501
1502
  },
1502
1503
  {
1503
1504
  "cell_type": "code",
@@ -1592,7 +1593,7 @@
1592
1593
  "outputs": [],
1593
1594
  "source": [
1594
1595
  "# Create a point plot with error bars\n",
1595
- "g = sns.pointplot(data=results_filtered, x=\"n\", y=\"Gini\", linestyle=\"None\")\n",
1596
+ "g = sns.pointplot(data=results_filtered, x=\"n\", y=\"Gini\", linestyle='None')\n",
1596
1597
  "g.figure.set_size_inches(8, 4)\n",
1597
1598
  "g.set(\n",
1598
1599
  " xlabel=\"number of agents\",\n",
@@ -1679,7 +1680,7 @@
1679
1680
  },
1680
1681
  "outputs": [],
1681
1682
  "source": [
1682
- "params = {\"seed\": None, \"width\": 10, \"height\": 10, \"n\": [5, 10, 20, 40, 80]}\n",
1683
+ "params = {\"seed\":None,\"width\": 10, \"height\": 10, \"n\": [5, 10, 20, 40, 80]}\n",
1683
1684
  "\n",
1684
1685
  "results_5s = mesa.batch_run(\n",
1685
1686
  " MoneyModel,\n",
@@ -1753,8 +1754,8 @@
1753
1754
  "metadata": {},
1754
1755
  "outputs": [],
1755
1756
  "source": [
1756
- "# Challenge: Treat the seed as a parameter and see the impact on the Gini Coefficient.\n",
1757
- "# You can also plot the seeds against the Gini Coefficient by changing the \"hue\" parameter in sns.lineplot function."
1757
+ "# Challenge: Treat the seed as a parameter and see the impact on the Gini Coefficient. \n",
1758
+ "# You can also plot the seeds against the Gini Coefficient by changing the \"hue\" parameter in sns.lineplot function. "
1758
1759
  ]
1759
1760
  },
1760
1761
  {
@@ -13,16 +13,16 @@ from mesa.datacollection import DataCollector
13
13
  from mesa.model import Model
14
14
 
15
15
  __all__ = [
16
+ "Model",
16
17
  "Agent",
18
+ "space",
17
19
  "DataCollector",
18
- "Model",
19
20
  "batch_run",
20
21
  "experimental",
21
- "space",
22
22
  ]
23
23
 
24
24
  __title__ = "mesa"
25
- __version__ = "3.1.0"
25
+ __version__ = "3.1.0.dev"
26
26
  __license__ = "Apache 2.0"
27
27
  _this_year = datetime.datetime.now(tz=datetime.UTC).date().year
28
28
  __copyright__ = f"Copyright {_this_year} Project Mesa Team"