Mesa 3.0.0b0__py3-none-any.whl → 3.0.0b2__py3-none-any.whl

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 (85) hide show
  1. mesa/__init__.py +2 -1
  2. mesa/agent.py +37 -27
  3. mesa/examples/README.md +37 -0
  4. mesa/examples/__init__.py +21 -0
  5. mesa/examples/advanced/__init__.py +0 -0
  6. mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +116 -0
  7. mesa/examples/advanced/epstein_civil_violence/Readme.md +34 -0
  8. mesa/examples/advanced/epstein_civil_violence/__init__.py +0 -0
  9. mesa/examples/advanced/epstein_civil_violence/agents.py +158 -0
  10. mesa/examples/advanced/epstein_civil_violence/app.py +72 -0
  11. mesa/examples/advanced/epstein_civil_violence/model.py +146 -0
  12. mesa/examples/advanced/pd_grid/Readme.md +43 -0
  13. mesa/examples/advanced/pd_grid/__init__.py +0 -0
  14. mesa/examples/advanced/pd_grid/agents.py +50 -0
  15. mesa/examples/advanced/pd_grid/analysis.ipynb +228 -0
  16. mesa/examples/advanced/pd_grid/app.py +50 -0
  17. mesa/examples/advanced/pd_grid/model.py +71 -0
  18. mesa/examples/advanced/sugarscape_g1mt/Readme.md +64 -0
  19. mesa/examples/advanced/sugarscape_g1mt/__init__.py +0 -0
  20. mesa/examples/advanced/sugarscape_g1mt/agents.py +344 -0
  21. mesa/examples/advanced/sugarscape_g1mt/app.py +70 -0
  22. mesa/examples/advanced/sugarscape_g1mt/model.py +180 -0
  23. mesa/examples/advanced/sugarscape_g1mt/sugar-map.txt +50 -0
  24. mesa/examples/advanced/sugarscape_g1mt/tests.py +69 -0
  25. mesa/examples/advanced/wolf_sheep/Readme.md +57 -0
  26. mesa/examples/advanced/wolf_sheep/__init__.py +0 -0
  27. mesa/examples/advanced/wolf_sheep/agents.py +102 -0
  28. mesa/examples/advanced/wolf_sheep/app.py +77 -0
  29. mesa/examples/advanced/wolf_sheep/model.py +137 -0
  30. mesa/examples/basic/__init__.py +0 -0
  31. mesa/examples/basic/boid_flockers/Readme.md +22 -0
  32. mesa/examples/basic/boid_flockers/__init__.py +0 -0
  33. mesa/examples/basic/boid_flockers/agents.py +71 -0
  34. mesa/examples/basic/boid_flockers/app.py +58 -0
  35. mesa/examples/basic/boid_flockers/model.py +69 -0
  36. mesa/examples/basic/boltzmann_wealth_model/Readme.md +56 -0
  37. mesa/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
  38. mesa/examples/basic/boltzmann_wealth_model/agents.py +31 -0
  39. mesa/examples/basic/boltzmann_wealth_model/app.py +65 -0
  40. mesa/examples/basic/boltzmann_wealth_model/model.py +43 -0
  41. mesa/examples/basic/boltzmann_wealth_model/st_app.py +115 -0
  42. mesa/examples/basic/conways_game_of_life/Readme.md +39 -0
  43. mesa/examples/basic/conways_game_of_life/__init__.py +0 -0
  44. mesa/examples/basic/conways_game_of_life/agents.py +47 -0
  45. mesa/examples/basic/conways_game_of_life/app.py +39 -0
  46. mesa/examples/basic/conways_game_of_life/model.py +31 -0
  47. mesa/examples/basic/conways_game_of_life/st_app.py +72 -0
  48. mesa/examples/basic/schelling/Readme.md +40 -0
  49. mesa/examples/basic/schelling/__init__.py +0 -0
  50. mesa/examples/basic/schelling/agents.py +26 -0
  51. mesa/examples/basic/schelling/analysis.ipynb +205 -0
  52. mesa/examples/basic/schelling/app.py +42 -0
  53. mesa/examples/basic/schelling/model.py +59 -0
  54. mesa/examples/basic/virus_on_network/Readme.md +61 -0
  55. mesa/examples/basic/virus_on_network/__init__.py +0 -0
  56. mesa/examples/basic/virus_on_network/agents.py +69 -0
  57. mesa/examples/basic/virus_on_network/app.py +136 -0
  58. mesa/examples/basic/virus_on_network/model.py +96 -0
  59. mesa/experimental/__init__.py +8 -2
  60. mesa/experimental/cell_space/cell.py +9 -0
  61. mesa/experimental/cell_space/discrete_space.py +13 -1
  62. mesa/experimental/cell_space/grid.py +13 -0
  63. mesa/experimental/cell_space/network.py +3 -0
  64. mesa/experimental/devs/eventlist.py +6 -0
  65. mesa/model.py +76 -12
  66. mesa/space.py +70 -5
  67. mesa/time.py +5 -3
  68. mesa/visualization/components/altair.py +87 -19
  69. mesa/visualization/components/matplotlib.py +65 -16
  70. mesa/visualization/solara_viz.py +13 -58
  71. {mesa-3.0.0b0.dist-info → mesa-3.0.0b2.dist-info}/METADATA +1 -3
  72. mesa-3.0.0b2.dist-info/RECORD +93 -0
  73. mesa/cookiecutter-mesa/cookiecutter.json +0 -8
  74. mesa/cookiecutter-mesa/hooks/post_gen_project.py +0 -13
  75. mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md +0 -4
  76. mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate +0 -27
  77. mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate +0 -11
  78. mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py +0 -1
  79. mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate +0 -60
  80. mesa/main.py +0 -65
  81. mesa-3.0.0b0.dist-info/RECORD +0 -45
  82. {mesa-3.0.0b0.dist-info → mesa-3.0.0b2.dist-info}/WHEEL +0 -0
  83. {mesa-3.0.0b0.dist-info → mesa-3.0.0b2.dist-info}/entry_points.txt +0 -0
  84. {mesa-3.0.0b0.dist-info → mesa-3.0.0b2.dist-info}/licenses/LICENSE +0 -0
  85. {mesa-3.0.0b0.dist-info → mesa-3.0.0b2.dist-info}/licenses/NOTICE +0 -0
@@ -30,10 +30,8 @@ from typing import TYPE_CHECKING, Literal
30
30
 
31
31
  import reacton.core
32
32
  import solara
33
- from solara.alias import rv
34
33
 
35
34
  import mesa.visualization.components.altair as components_altair
36
- import mesa.visualization.components.matplotlib as components_matplotlib
37
35
  from mesa.visualization.UserParam import Slider
38
36
  from mesa.visualization.utils import force_update, update_counter
39
37
 
@@ -41,55 +39,6 @@ if TYPE_CHECKING:
41
39
  from mesa.model import Model
42
40
 
43
41
 
44
- # TODO: Turn this function into a Solara component once the current_step.value
45
- # dependency is passed to measure()
46
- def Card(
47
- model, measures, agent_portrayal, space_drawer, dependencies, color, layout_type
48
- ):
49
- """Create a card component for visualizing model space or measures.
50
-
51
- Args:
52
- model: The Mesa model instance
53
- measures: List of measures to be plotted
54
- agent_portrayal: Function to define agent appearance
55
- space_drawer: Method to render agent space
56
- dependencies: List of dependencies for updating the visualization
57
- color: Background color of the card
58
- layout_type: Type of layout (Space or Measure)
59
-
60
- Returns:
61
- rv.Card: A card component containing the visualization
62
- """
63
- with rv.Card(
64
- style_=f"background-color: {color}; width: 100%; height: 100%"
65
- ) as main:
66
- if "Space" in layout_type:
67
- rv.CardTitle(children=["Space"])
68
- if space_drawer == "default":
69
- # draw with the default implementation
70
- components_matplotlib.SpaceMatplotlib(
71
- model, agent_portrayal, dependencies=dependencies
72
- )
73
- elif space_drawer == "altair":
74
- components_altair.SpaceAltair(
75
- model, agent_portrayal, dependencies=dependencies
76
- )
77
- elif space_drawer:
78
- # if specified, draw agent space with an alternate renderer
79
- space_drawer(model, agent_portrayal, dependencies=dependencies)
80
- elif "Measure" in layout_type:
81
- rv.CardTitle(children=["Measure"])
82
- measure = measures[layout_type["Measure"]]
83
- if callable(measure):
84
- # Is a custom object
85
- measure(model)
86
- else:
87
- components_matplotlib.PlotMatplotlib(
88
- model, measure, dependencies=dependencies
89
- )
90
- return main
91
-
92
-
93
42
  @solara.component
94
43
  def SolaraViz(
95
44
  model: Model | solara.Reactive[Model],
@@ -207,10 +156,16 @@ def ComponentsView(
207
156
  model: Model instance to pass to each component
208
157
  """
209
158
  wrapped_components = [_wrap_component(component) for component in components]
210
-
211
- with solara.Column():
212
- for component in wrapped_components:
213
- component(model)
159
+ items = [component(model) for component in wrapped_components]
160
+ grid_layout_initial = make_initial_grid_layout(num_components=len(items))
161
+ grid_layout, set_grid_layout = solara.use_state(grid_layout_initial)
162
+ solara.GridDraggable(
163
+ items=items,
164
+ grid_layout=grid_layout,
165
+ resizable=True,
166
+ draggable=True,
167
+ on_grid_layout=set_grid_layout,
168
+ )
214
169
 
215
170
 
216
171
  JupyterViz = SolaraViz
@@ -448,11 +403,11 @@ def UserInputs(user_params, on_change=None):
448
403
  raise ValueError(f"{input_type} is not a supported input type")
449
404
 
450
405
 
451
- def make_initial_grid_layout(layout_types):
406
+ def make_initial_grid_layout(num_components):
452
407
  """Create an initial grid layout for visualization components.
453
408
 
454
409
  Args:
455
- layout_types: List of layout types (Space or Measure)
410
+ num_components: Number of components to display
456
411
 
457
412
  Returns:
458
413
  list: Initial grid layout configuration
@@ -466,7 +421,7 @@ def make_initial_grid_layout(layout_types):
466
421
  "x": 6 * (i % 2),
467
422
  "y": 16 * (i - i % 2),
468
423
  }
469
- for i in range(len(layout_types))
424
+ for i in range(num_components)
470
425
  ]
471
426
 
472
427
 
@@ -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'
@@ -0,0 +1,93 @@
1
+ mesa/__init__.py,sha256=Bld7cqsOkGY-bJUf3fuXBts9eH5TRlebkX8pZNI7l9M,659
2
+ mesa/agent.py,sha256=Ein1Ei7n1wZNKcv4L1NlP3iPu9q1pm-QGIL64dLC5Fw,24636
3
+ mesa/batchrunner.py,sha256=0AqTcvjWNPp1aqn7zuUKSovx6Rnkk4M-KouCZ4Guqy0,6419
4
+ mesa/datacollection.py,sha256=xyb07aBpd-HSDh5bk-XcVqGiDu5bfaLlxj5eDlGIwqY,16138
5
+ mesa/model.py,sha256=fojtI87UxDLnRB71CGUKbZWh0BrstBHoCU9xWcw-MsA,10406
6
+ mesa/space.py,sha256=f9TaLgb2nFPNiZn-Mgr5votcn80BBU_LnOm8fbLkEWw,65052
7
+ mesa/time.py,sha256=5yWubqst13MfjXpsYjY-MNdIQH3KWi373KRmRZT5BBo,15044
8
+ mesa/examples/README.md,sha256=-H6ECbl2bqkAK3PKz6ixlm9pN13f-CyKfNssm2Kbyw0,2810
9
+ mesa/examples/__init__.py,sha256=iJpTRiCJUwLVA253t5BIxoX3bFnPJ2_XPzET3ev5mxg,835
10
+ mesa/examples/advanced/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb,sha256=yh50ZAK2BVJyJIKsQTTxywnasqWn1IiQUVrwmZKue4w,29032
12
+ mesa/examples/advanced/epstein_civil_violence/Readme.md,sha256=IEU5IZTe5EbvAA2vkYxiIw8vK3O0MZcjbxzn8I2cQic,1874
13
+ mesa/examples/advanced/epstein_civil_violence/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ mesa/examples/advanced/epstein_civil_violence/agents.py,sha256=R1Nu-_c_qBPCvr1vl6GgamOP4AUV9GJdcF3V7frAgdY,5676
15
+ mesa/examples/advanced/epstein_civil_violence/app.py,sha256=GpfqVX6iu3EydsikrPT_JZKkXpb-WHHuwBYP_NZqivY,2062
16
+ mesa/examples/advanced/epstein_civil_violence/model.py,sha256=HFA6hsxHVXwjqSlTA7EB9-kctiuzIWWod0zdbEv7y84,5193
17
+ mesa/examples/advanced/pd_grid/Readme.md,sha256=UVUQxZRFdfymCKDdQEn3ZEwgSqgp9cKJPsU8oZpLFnY,2367
18
+ mesa/examples/advanced/pd_grid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ mesa/examples/advanced/pd_grid/agents.py,sha256=DzGj4LZUjV0xMQAwkRsv2Aoap1cUvLscJswfA1PdVDs,1716
20
+ mesa/examples/advanced/pd_grid/analysis.ipynb,sha256=ReYtRe2JVyCCXoMBONvynXDQ_eGtQSWhNcuJY3CYTTI,82323
21
+ mesa/examples/advanced/pd_grid/app.py,sha256=y-W_cWeaXDtsK02ptM1tR8VbHUGO5DMua1Rf9qB7Cgo,1370
22
+ mesa/examples/advanced/pd_grid/model.py,sha256=iKy1Oa5lG_hlxwlw67NfFLP9dKk5uDreaaT0xO9-55A,2325
23
+ mesa/examples/advanced/sugarscape_g1mt/Readme.md,sha256=x3kKw1Rre2FPkNhGDLtdzeThmH089mxsGYUPZUeu26k,3595
24
+ mesa/examples/advanced/sugarscape_g1mt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ mesa/examples/advanced/sugarscape_g1mt/agents.py,sha256=zE7zbO2_OaQiFDq_-t-0hv4ButBWv26dnS1zaPc3_ZE,10183
26
+ mesa/examples/advanced/sugarscape_g1mt/app.py,sha256=qyVXRABxwvl3bAC6kC_t69JdunBe-RE-jCUyXASN5lo,2032
27
+ mesa/examples/advanced/sugarscape_g1mt/model.py,sha256=VVoUni3N2yk7vLEcWC1hiQemaa1vmzJU3gKxVRXxnqM,6069
28
+ mesa/examples/advanced/sugarscape_g1mt/sugar-map.txt,sha256=zZtGYciBPT4miZVnbVuoQ5TugTmGrbDWV9yb5KH6tnU,5000
29
+ mesa/examples/advanced/sugarscape_g1mt/tests.py,sha256=UNahmZTgLquSqmoi_9GcE3JP0qBHjkrHFZ15NMm0ce8,2517
30
+ mesa/examples/advanced/wolf_sheep/Readme.md,sha256=6zrtCg4Fb-hgQxqdLMpTkIYMwD6owCv8BMz_qn0N98Q,3165
31
+ mesa/examples/advanced/wolf_sheep/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
+ mesa/examples/advanced/wolf_sheep/agents.py,sha256=UocDCsKmXkWxt0-ToVIOhBjX-amYwMtZbHN8U2AolFI,3068
33
+ mesa/examples/advanced/wolf_sheep/app.py,sha256=oqb8ZsEj7aP-Rhh5RiuQ9c8Za1wrbmtrehq8lUDlGgA,2066
34
+ mesa/examples/advanced/wolf_sheep/model.py,sha256=qtCTA2fBP9lA7jJ8UUJ5SIy8gXW7K73YoY8F3YDKp6k,4522
35
+ mesa/examples/basic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
+ mesa/examples/basic/boid_flockers/Readme.md,sha256=4KJinsLPtUciQSMzvaX3tU5r1HTUg3AFOFDKy73W5RE,894
37
+ mesa/examples/basic/boid_flockers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ mesa/examples/basic/boid_flockers/agents.py,sha256=QXT1zxOq_kdk_w60H2zPV3KpivzCHQ-ApyFIIDvxvok,2693
39
+ mesa/examples/basic/boid_flockers/app.py,sha256=QutSC7do1EgYATzJ-uSJTyoAtvM3HoVv9E3JRSviFP4,1269
40
+ mesa/examples/basic/boid_flockers/model.py,sha256=o335lgyGQ1E5TkAj4B-INhUL65mO0dEV3tf3gG40FvU,2201
41
+ mesa/examples/basic/boltzmann_wealth_model/Readme.md,sha256=wl1ylO9KWoTiuIJKOnk2FGdcmyVUqJ5wiSbVUa3WWAc,2725
42
+ mesa/examples/basic/boltzmann_wealth_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
+ mesa/examples/basic/boltzmann_wealth_model/agents.py,sha256=uVUo9jWQnv5I3uCaYE_N7X-cOdHhdy6RtLUL_znELgI,892
44
+ mesa/examples/basic/boltzmann_wealth_model/app.py,sha256=MmTWGFT-BiWobXeTIAcfehVxjC0tQdsM9ILTGoPHXCw,1943
45
+ mesa/examples/basic/boltzmann_wealth_model/model.py,sha256=BYcfR5Nw0zXkKP72CoVnLkIvV-IVnNKKNQ7KsbJ07pc,1508
46
+ mesa/examples/basic/boltzmann_wealth_model/st_app.py,sha256=v3Je2hSe8nXPgfmZhX8lHM-7xs8dk2g1Zz0X81AqX3k,3466
47
+ mesa/examples/basic/conways_game_of_life/Readme.md,sha256=VRgN6roF6leQ_IMYwxFypSfFjZo9jnCd-rkPTjpp7II,1453
48
+ mesa/examples/basic/conways_game_of_life/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
+ mesa/examples/basic/conways_game_of_life/agents.py,sha256=ETn87GV8it9p0nlSn6f1qu5CDEmqokkr6Rq7KWaT-5U,1627
50
+ mesa/examples/basic/conways_game_of_life/app.py,sha256=2r3j5aFuNAMrlRd8nAAexRNViOfj86pLuZTd8FWKv0E,1232
51
+ mesa/examples/basic/conways_game_of_life/model.py,sha256=c7lwSelxTplbQlbfGjBSevS2TEg5DFJA8bvhbYbyD_s,1174
52
+ mesa/examples/basic/conways_game_of_life/st_app.py,sha256=_poqU2VR4rfiiq4WFXTbOUSW7liuM86iq913mW6LS50,2400
53
+ mesa/examples/basic/schelling/Readme.md,sha256=CRKBfYtnLJLlTKLsTRQ-7gsQRxVxDooOBN5uP8PEtaU,2296
54
+ mesa/examples/basic/schelling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
+ mesa/examples/basic/schelling/agents.py,sha256=dvznzN2As979x-4EH8Y-i7HhlCuv1OdtWYebOdxTdhk,773
56
+ mesa/examples/basic/schelling/analysis.ipynb,sha256=JDJy6-U6eO-LrHWxZr1c3lkvtoY0DNHa-kJ4J-Z-wwo,5804
57
+ mesa/examples/basic/schelling/app.py,sha256=-SXLVg7KPzquh7LausjqTzJh_EA3fFn4xXmY3H4Ba38,973
58
+ mesa/examples/basic/schelling/model.py,sha256=szYiw76JD-OMlZ2Op80Y9L2PZ3VMVfyuUNl1J_jC8BE,1856
59
+ mesa/examples/basic/virus_on_network/Readme.md,sha256=UnCkKiJK7wVw40a-oDR6qdf3QpCsBhgNOVZg-2UXPlc,2528
60
+ mesa/examples/basic/virus_on_network/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
+ mesa/examples/basic/virus_on_network/agents.py,sha256=a_WhqYblJlW6od67eXfU-nb7IMRyYpgxtf0le--VYoA,1975
62
+ mesa/examples/basic/virus_on_network/app.py,sha256=EQfXYV94GdnC71hVIl9Zpy4JqKNRFINCJxHFdOKbNTU,3340
63
+ mesa/examples/basic/virus_on_network/model.py,sha256=jQoCmvygwCvhUrlL0l7V8GcDLv94CgwtuK7DDGU8q8g,2813
64
+ mesa/experimental/UserParam.py,sha256=f32nmFjroe76HpxU75ZCEOqFW2nAsDfmqIf8kQ1zt-E,2086
65
+ mesa/experimental/__init__.py,sha256=faBYyHSp-sFQPaBx8-WsLToVKCndpSzpt18HmNZtasM,385
66
+ mesa/experimental/solara_viz.py,sha256=uWrNQAX3oEWSftmyjNorN839dBCUp86hnhpL704dyGQ,15212
67
+ mesa/experimental/cell_space/__init__.py,sha256=-NtSCT7mA-aszLSAdqbICGqeFe2vBdb-GrcW562legY,999
68
+ mesa/experimental/cell_space/cell.py,sha256=lDm7NQhPDFf3-SZu5W594lDNGtzcdSPUSSsELFRg0bs,7166
69
+ mesa/experimental/cell_space/cell_agent.py,sha256=jvYOV9OIaBaqAsAG0YLV64X_f3BJe_wP7qfos_RXi0Y,3759
70
+ mesa/experimental/cell_space/cell_collection.py,sha256=ZcyuPEevCZEXW7jFnX6StjBMw4UBDQvUspZRcFi2dFg,3426
71
+ mesa/experimental/cell_space/discrete_space.py,sha256=sD5455phlIthnAK6OsgxVscQ4C_HSVWA9e476C3PuF0,5264
72
+ mesa/experimental/cell_space/grid.py,sha256=oWTy6kaaHXLPneA-w5XdqzwA0YItMWYgCq_UjNH9iA8,7711
73
+ mesa/experimental/cell_space/network.py,sha256=_x0zKlI-odNCSRb_Zqh4nBPjqnW5iVj8sVheKPCLzmU,1321
74
+ mesa/experimental/cell_space/voronoi.py,sha256=lSY8zQhELvOy0RfDyZIek09UMwY9_20UY9SPqFWsNoM,10014
75
+ mesa/experimental/components/altair.py,sha256=49OHgrm1JncfrKqDfw_5ifPtsbMKdgVYCacL9SMwucc,2624
76
+ mesa/experimental/components/matplotlib.py,sha256=j477UBk_7yW5vzT3rjhnuTixpA7PedDNghoK9TLgHVY,8043
77
+ mesa/experimental/devs/__init__.py,sha256=EByaC66ikUIu9G9p1geLm6ESEMWZOPTO9r9627S83j0,211
78
+ mesa/experimental/devs/eventlist.py,sha256=fPj2jfW-jTe-UnIE6TsF1BM2ITKe3jGfVUhu3gBv7UQ,6250
79
+ mesa/experimental/devs/simulator.py,sha256=wvqkLIDgbJNaem9nwMacyEYRp0W3ai5Oxptw3-QmbSw,10595
80
+ mesa/experimental/devs/examples/epstein_civil_violence.py,sha256=E8YSV3O5ihKsntGtnltHM-4IyS8eg2DSRUqmIiw_1iU,10916
81
+ mesa/experimental/devs/examples/wolf_sheep.py,sha256=1eb1CfYNQoprqSJat-LPYPvwWH1ENQdj39viEqwSk0s,8103
82
+ mesa/visualization/UserParam.py,sha256=Dl2WOwLYLf0pfLpabCZtIdFRyKZrK6Qtc3utZx5GPYg,2139
83
+ mesa/visualization/__init__.py,sha256=sa8lqeLcDtte19SMzFiKP6K4CrVLxAPwrhDu_AsDWTs,395
84
+ mesa/visualization/solara_viz.py,sha256=SHlQ8Y4k6EU7LxlJjjvvjDJWGWryahjQXCwMiVgoF0E,14944
85
+ mesa/visualization/utils.py,sha256=lJHgRKF5BHLf72Tw3YpwyiWuRoIimaTKQ7xBCw_Rx3A,146
86
+ mesa/visualization/components/altair.py,sha256=e_J3ZPv4ldtJje5pUm1UgNqcMh7Nc4fyIgvbbcCWESg,4856
87
+ mesa/visualization/components/matplotlib.py,sha256=EBK1zRCl71LkOgeOV7eQE1Ig22n1ZFGtNBhweozPFYk,13241
88
+ mesa-3.0.0b2.dist-info/METADATA,sha256=8FG5-NHehf7et0SOy8FKHCFH-9nvMwOhKpXNi6vfl10,9849
89
+ mesa-3.0.0b2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
90
+ mesa-3.0.0b2.dist-info/entry_points.txt,sha256=IOcQtetGF8l4wHpOs_hGb19Rz-FS__BMXOJR10IBPsA,39
91
+ mesa-3.0.0b2.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
92
+ mesa-3.0.0b2.dist-info/licenses/NOTICE,sha256=GbsWoK0QWv1JyZ_xer2s-jNilv0RtWl-0UrtlJANHPg,578
93
+ mesa-3.0.0b2.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- {
2
- "project": "Example Project",
3
- "snake": "{{ cookiecutter.project.lower().replace(' ', '_') }}",
4
- "camel": "{{ cookiecutter.project.title().replace(' ', '') }}",
5
- "agent": "{{ cookiecutter.camel + 'Agent'}}",
6
- "model": "{{ cookiecutter.camel + 'Model'}}",
7
- "description": "Example short description of the project"
8
- }
@@ -1,13 +0,0 @@
1
- """helper module."""
2
-
3
- import glob
4
- import os
5
-
6
- file_list = glob.glob("**/*.pytemplate", recursive=True)
7
-
8
- for file_path in file_list:
9
- # Check if the file is a regular file
10
- if not os.path.isfile(file_path):
11
- continue
12
- # Rename the file
13
- os.rename(file_path, file_path.replace(".pytemplate", ".py"))
@@ -1,4 +0,0 @@
1
- {{cookiecutter.project}}
2
- ========================
3
-
4
- {{cookiecutter.description}}
@@ -1,27 +0,0 @@
1
- """
2
- Configure visualization elements and instantiate a server
3
- """
4
- from mesa.visualization import SolaraViz
5
-
6
- from {{ cookiecutter.snake }}.model import {{ cookiecutter.model }}, {{ cookiecutter.agent }} # noqa
7
-
8
- import mesa
9
-
10
-
11
- def circle_portrayal_example(agent):
12
- return {
13
- "size": 40,
14
- # This is Matplotlib's color
15
- "color": "tab:pink",
16
- }
17
-
18
-
19
- model_params = {"num_agents": 10, "width": 10, "height": 10}
20
-
21
- page = SolaraViz(
22
- {{cookiecutter.model}},
23
- model_params,
24
- measures=["num_agents"],
25
- agent_portrayal=circle_portrayal_example
26
- )
27
- page # noqa
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env python
2
- from setuptools import find_packages, setup
3
-
4
- requires = ["mesa"]
5
-
6
- setup(
7
- name="{{cookiecutter.snake}}",
8
- version="0.0.1",
9
- packages=find_packages(),
10
- install_requires=requires,
11
- )
@@ -1,60 +0,0 @@
1
- import mesa
2
-
3
-
4
- class {{cookiecutter.agent}}(mesa.Agent): # noqa
5
- """
6
- An agent
7
- """
8
-
9
- def __init__(self, unique_id, model):
10
- """
11
- Customize the agent
12
- """
13
- self.unique_id = unique_id
14
- super().__init__(unique_id, model)
15
-
16
- def step(self):
17
- """
18
- Modify this method to change what an individual agent will do during each step.
19
- Can include logic based on neighbors states.
20
- """
21
- pass
22
-
23
-
24
- class {{cookiecutter.model}}(mesa.Model):
25
- """
26
- The model class holds the model-level attributes, manages the agents, and generally handles
27
- the global level of our model.
28
-
29
- There is only one model-level parameter: how many agents the model contains. When a new model
30
- is started, we want it to populate itself with the given number of agents.
31
-
32
- The scheduler is a special model component which controls the order in which agents are activated.
33
- """
34
-
35
- def __init__(self, num_agents, width, height):
36
- super().__init__()
37
- self.num_agents = num_agents
38
- self.schedule = mesa.time.RandomActivation(self)
39
- self.grid = mesa.space.MultiGrid(width=width, height=height, torus=True)
40
-
41
- for i in range(self.num_agents):
42
- agent = {{cookiecutter.agent}}(i, self)
43
- self.schedule.add(agent)
44
-
45
- x = self.random.randrange(self.grid.width)
46
- y = self.random.randrange(self.grid.height)
47
- self.grid.place_agent(agent, (x, y))
48
-
49
- # example data collector
50
- self.datacollector = mesa.datacollection.DataCollector({"num_agents": "num_agents"})
51
-
52
- self.running = True
53
- self.datacollector.collect(self)
54
-
55
- def step(self):
56
- """
57
- A model step. Used for collecting data and advancing the schedule
58
- """
59
- self.datacollector.collect(self)
60
- self.schedule.step()
mesa/main.py DELETED
@@ -1,65 +0,0 @@
1
- """main module for running mesa models with a server."""
2
-
3
- import os
4
- import sys
5
- from pathlib import Path
6
- from subprocess import call
7
-
8
- import click
9
-
10
- from mesa import __version__
11
-
12
- PROJECT_PATH = click.Path(
13
- exists=True, file_okay=False, dir_okay=True, resolve_path=True
14
- )
15
- COOKIECUTTER_DIR = "mesa/cookiecutter-mesa"
16
- SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
17
- COOKIECUTTER_PATH = os.path.join(os.path.dirname(SCRIPTS_DIR), COOKIECUTTER_DIR)
18
-
19
- CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}
20
-
21
-
22
- @click.group(context_settings=CONTEXT_SETTINGS)
23
- def cli():
24
- """Manage Mesa projects."""
25
-
26
-
27
- @cli.command()
28
- @click.argument("project", type=PROJECT_PATH, default=".")
29
- def runserver(project):
30
- """Run mesa project PROJECT.
31
-
32
- PROJECT is the path to the directory containing `run.py`, or the current
33
- directory if not specified.
34
- """
35
- run_files = ["run.py", "server.py"]
36
- for run_file in run_files:
37
- run_path = Path(project) / run_file
38
- if not run_path.exists():
39
- continue
40
- args = [sys.executable, str(run_path)]
41
- call(args)
42
- sys.exit(f"ERROR: file run.py or server.py (in {Path(project)}) does not exist")
43
-
44
-
45
- @click.command()
46
- @click.option(
47
- "--no-input", is_flag=True, help="Do not prompt user for custom mesa model input."
48
- )
49
- def startproject(no_input):
50
- """Create a new mesa project."""
51
- args = ["cookiecutter", COOKIECUTTER_PATH]
52
- if no_input:
53
- args.append("--no-input")
54
- call(args)
55
-
56
-
57
- @click.command()
58
- def version():
59
- """Show the version of mesa."""
60
- print(f"mesa {__version__}")
61
-
62
-
63
- cli.add_command(runserver)
64
- cli.add_command(startproject)
65
- cli.add_command(version)
@@ -1,45 +0,0 @@
1
- mesa/__init__.py,sha256=GM836SFDxNMX8ePHbGQt5Yi4G3jiYLyOb3f-AUDLmaQ,618
2
- mesa/agent.py,sha256=XeBMwbq7Ruhbt6xj9PPEDuDMtO185Bff9dOFagUxiq8,24254
3
- mesa/batchrunner.py,sha256=0AqTcvjWNPp1aqn7zuUKSovx6Rnkk4M-KouCZ4Guqy0,6419
4
- mesa/datacollection.py,sha256=xyb07aBpd-HSDh5bk-XcVqGiDu5bfaLlxj5eDlGIwqY,16138
5
- mesa/main.py,sha256=_KgeVGbi0znzezjjoM09vhGdyaqcuDEwb9M7vH2c_O4,1668
6
- mesa/model.py,sha256=zMs5_ZlLity7hYcrwhz1BY1ysK3y3aQa9hf1KIoxryM,7845
7
- mesa/space.py,sha256=1sVl78o5lYP6aEg32QIb9-tcv3V3UeFdC7A_h_8CgO8,62838
8
- mesa/time.py,sha256=FaVqRwWWdFH6iagfXrdmCN7YSvRpDmikyzfz6GJ8yU4,14977
9
- mesa/cookiecutter-mesa/cookiecutter.json,sha256=tBSWli39fOWUXGfiDCTKd92M7uKaBIswXbkOdbUufYY,337
10
- mesa/cookiecutter-mesa/hooks/post_gen_project.py,sha256=UKz12l6mKc7fILK0MvV5djsTKwkmD4DlH8LYjFO8ehI,316
11
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md,sha256=Yji4lGY-NtQSnW-oBj0_Jhs-XhCfZA8R1mBBM_IllGs,80
12
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate,sha256=36f9k9CH6TK6VrXsPvTFXGUfCKzCLwgYTeK-Gt27GNg,584
13
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate,sha256=UtRpLM_CkeUZRec-Ef_LiO_x7SKaWN11fOiH9T1UmTw,214
14
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py,sha256=WgJccMfsAlD_mA3zTBPJVHadF3FtO8xgi8SPKORzyMs,22
15
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate,sha256=Aml4Z6E1yj7E7DtHNSUqnKNRUdkxG9WWtJyW8fkxCng,1870
16
- mesa/experimental/UserParam.py,sha256=f32nmFjroe76HpxU75ZCEOqFW2nAsDfmqIf8kQ1zt-E,2086
17
- mesa/experimental/__init__.py,sha256=1hxkjcZvdJhhQx4iLlTTUAPs_SqRyN-us4qR8U6JKkw,209
18
- mesa/experimental/solara_viz.py,sha256=uWrNQAX3oEWSftmyjNorN839dBCUp86hnhpL704dyGQ,15212
19
- mesa/experimental/cell_space/__init__.py,sha256=-NtSCT7mA-aszLSAdqbICGqeFe2vBdb-GrcW562legY,999
20
- mesa/experimental/cell_space/cell.py,sha256=lR1lz9hMlfKsDoRzSPCqb0XTk2VIEFqxIiN_zwUaUUo,6738
21
- mesa/experimental/cell_space/cell_agent.py,sha256=jvYOV9OIaBaqAsAG0YLV64X_f3BJe_wP7qfos_RXi0Y,3759
22
- mesa/experimental/cell_space/cell_collection.py,sha256=ZcyuPEevCZEXW7jFnX6StjBMw4UBDQvUspZRcFi2dFg,3426
23
- mesa/experimental/cell_space/discrete_space.py,sha256=bl8jmYnOLFaF5_0Wh7BFQetXr53cS-SNLzHTjtkOnVY,4845
24
- mesa/experimental/cell_space/grid.py,sha256=WT9AtQCgPzV8VonX0oSPRXgZNXoOR_mVgEAEOp5I4YA,7319
25
- mesa/experimental/cell_space/network.py,sha256=hzhxGipRyM1PWOQFlPz--tc3pA_RRBT8Xq4pXHx5sD8,1252
26
- mesa/experimental/cell_space/voronoi.py,sha256=lSY8zQhELvOy0RfDyZIek09UMwY9_20UY9SPqFWsNoM,10014
27
- mesa/experimental/components/altair.py,sha256=49OHgrm1JncfrKqDfw_5ifPtsbMKdgVYCacL9SMwucc,2624
28
- mesa/experimental/components/matplotlib.py,sha256=j477UBk_7yW5vzT3rjhnuTixpA7PedDNghoK9TLgHVY,8043
29
- mesa/experimental/devs/__init__.py,sha256=EByaC66ikUIu9G9p1geLm6ESEMWZOPTO9r9627S83j0,211
30
- mesa/experimental/devs/eventlist.py,sha256=Trvc5S-NG5B792uuk_cY8Q_5Rw99zioUYDQXcXWVuCo,5972
31
- mesa/experimental/devs/simulator.py,sha256=wvqkLIDgbJNaem9nwMacyEYRp0W3ai5Oxptw3-QmbSw,10595
32
- mesa/experimental/devs/examples/epstein_civil_violence.py,sha256=E8YSV3O5ihKsntGtnltHM-4IyS8eg2DSRUqmIiw_1iU,10916
33
- mesa/experimental/devs/examples/wolf_sheep.py,sha256=1eb1CfYNQoprqSJat-LPYPvwWH1ENQdj39viEqwSk0s,8103
34
- mesa/visualization/UserParam.py,sha256=Dl2WOwLYLf0pfLpabCZtIdFRyKZrK6Qtc3utZx5GPYg,2139
35
- mesa/visualization/__init__.py,sha256=sa8lqeLcDtte19SMzFiKP6K4CrVLxAPwrhDu_AsDWTs,395
36
- mesa/visualization/solara_viz.py,sha256=6Gq4r4-XFt9AG6G-v2Gvz_W-ykTC4gP0OQnqtYIhAxw,16717
37
- mesa/visualization/utils.py,sha256=lJHgRKF5BHLf72Tw3YpwyiWuRoIimaTKQ7xBCw_Rx3A,146
38
- mesa/visualization/components/altair.py,sha256=E-iblqpWhx72qrjkNz4Ie9c66Hh1OFpLVjuDIg9m2sA,2804
39
- mesa/visualization/components/matplotlib.py,sha256=6ttFOxfNj3YdNu7c1NB0YP6-F7Chy0Qq0kkMe02TF8c,11697
40
- mesa-3.0.0b0.dist-info/METADATA,sha256=iqC2Ea-eu6tKAs5lwnnHS7Zoimp6ifPO8cJBb4o65UQ,9937
41
- mesa-3.0.0b0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
42
- mesa-3.0.0b0.dist-info/entry_points.txt,sha256=IOcQtetGF8l4wHpOs_hGb19Rz-FS__BMXOJR10IBPsA,39
43
- mesa-3.0.0b0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
44
- mesa-3.0.0b0.dist-info/licenses/NOTICE,sha256=GbsWoK0QWv1JyZ_xer2s-jNilv0RtWl-0UrtlJANHPg,578
45
- mesa-3.0.0b0.dist-info/RECORD,,
File without changes