Mesa 3.0.2__py3-none-any.whl → 3.0.3__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.

mesa/__init__.py CHANGED
@@ -24,7 +24,7 @@ __all__ = [
24
24
  ]
25
25
 
26
26
  __title__ = "mesa"
27
- __version__ = "3.0.2"
27
+ __version__ = "3.0.3"
28
28
  __license__ = "Apache 2.0"
29
29
  _this_year = datetime.datetime.now(tz=datetime.timezone.utc).date().year
30
30
  __copyright__ = f"Copyright {_this_year} Project Mesa Team"
@@ -48,8 +48,10 @@ class CellCollection(Generic[T]):
48
48
  else:
49
49
  self._cells = {cell: cell.agents for cell in cells}
50
50
 
51
- #
52
- self._capacity: int = next(iter(self._cells.keys())).capacity
51
+ # Get capacity from first cell if collection is not empty
52
+ self._capacity: int | None = (
53
+ next(iter(self._cells.keys())).capacity if self._cells else None
54
+ )
53
55
 
54
56
  if random is None:
55
57
  warnings.warn(
@@ -382,11 +382,17 @@ def ModelCreator(
382
382
  )
383
383
  user_params, fixed_params = split_model_params(user_params)
384
384
 
385
- # set model_parameters to the default values for all parameters
386
- model_parameters.value = {
387
- **fixed_params,
388
- **{k: v.get("value") for k, v in user_params.items()},
389
- }
385
+ # Use solara.use_effect to run the initialization code only once
386
+ solara.use_effect(
387
+ # set model_parameters to the default values for all parameters
388
+ lambda: model_parameters.set(
389
+ {
390
+ **fixed_params,
391
+ **{k: v.get("value") for k, v in user_params.items()},
392
+ }
393
+ ),
394
+ [],
395
+ )
390
396
 
391
397
  def on_change(name, value):
392
398
  model_parameters.value = {**model_parameters.value, name: value}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: Mesa
3
- Version: 3.0.2
3
+ Version: 3.0.3
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
@@ -1,4 +1,4 @@
1
- mesa/__init__.py,sha256=VuQfSpSoRqzqyiVdHe0lS5yFYaNIaZDHkacxmDc6oT4,657
1
+ mesa/__init__.py,sha256=B-mERjSf7OMn3SyxAszE2eRL-UaEmQyhOwntfnXlack,657
2
2
  mesa/agent.py,sha256=k85bw5iVX0MmaVlJg3mG_liobN_sIVsrZf76YZ_hMyA,25289
3
3
  mesa/batchrunner.py,sha256=sMFLTxj5avP_-HGO0leLVuxXK2dH0xdPopvhAmawwRQ,7213
4
4
  mesa/datacollection.py,sha256=xyb07aBpd-HSDh5bk-XcVqGiDu5bfaLlxj5eDlGIwqY,16138
@@ -67,7 +67,7 @@ mesa/experimental/solara_viz.py,sha256=uWrNQAX3oEWSftmyjNorN839dBCUp86hnhpL704dy
67
67
  mesa/experimental/cell_space/__init__.py,sha256=-NtSCT7mA-aszLSAdqbICGqeFe2vBdb-GrcW562legY,999
68
68
  mesa/experimental/cell_space/cell.py,sha256=lDm7NQhPDFf3-SZu5W594lDNGtzcdSPUSSsELFRg0bs,7166
69
69
  mesa/experimental/cell_space/cell_agent.py,sha256=jvYOV9OIaBaqAsAG0YLV64X_f3BJe_wP7qfos_RXi0Y,3759
70
- mesa/experimental/cell_space/cell_collection.py,sha256=ADK_42ykyWQpVGVSFE8GG_djqTgL8wfWwu2YTwXUPcs,4007
70
+ mesa/experimental/cell_space/cell_collection.py,sha256=MQNHj7n3b7wWLAZtTVQ9GeWjWcptwmROhQDckQr5TpM,4119
71
71
  mesa/experimental/cell_space/discrete_space.py,sha256=A54lHbTo4udcU4zkJEnsWuWKOBrELg-1eU8-dPoLMPk,5826
72
72
  mesa/experimental/cell_space/grid.py,sha256=oWTy6kaaHXLPneA-w5XdqzwA0YItMWYgCq_UjNH9iA8,7711
73
73
  mesa/experimental/cell_space/network.py,sha256=_x0zKlI-odNCSRb_Zqh4nBPjqnW5iVj8sVheKPCLzmU,1321
@@ -81,15 +81,15 @@ mesa/experimental/devs/examples/epstein_civil_violence.py,sha256=E8YSV3O5ihKsntG
81
81
  mesa/experimental/devs/examples/wolf_sheep.py,sha256=1eb1CfYNQoprqSJat-LPYPvwWH1ENQdj39viEqwSk0s,8103
82
82
  mesa/visualization/__init__.py,sha256=o30F2VApnDJ6Zq0_U5_wBnj-6-Bu7FGPsOq3A6p2EqA,743
83
83
  mesa/visualization/mpl_space_drawing.py,sha256=yf3Sc7pm5EJLxfWQdtR-9PcUtZveEEjar1WUr7qwI4o,20057
84
- mesa/visualization/solara_viz.py,sha256=pGtfjFfFMLwF9vmy5btiHRZww6NGoiKu0tzNdhZaYj4,17947
84
+ mesa/visualization/solara_viz.py,sha256=M58P1U_x1IfV3Ha4E2ZVo3mocux3wWnEJqPKwNPBgZE,18117
85
85
  mesa/visualization/user_param.py,sha256=Dl2WOwLYLf0pfLpabCZtIdFRyKZrK6Qtc3utZx5GPYg,2139
86
86
  mesa/visualization/utils.py,sha256=lJHgRKF5BHLf72Tw3YpwyiWuRoIimaTKQ7xBCw_Rx3A,146
87
87
  mesa/visualization/components/__init__.py,sha256=Bq3nrPikcaIo9BSs0O3zptWVLlUmAkLo3s0mEmpH1RE,3022
88
88
  mesa/visualization/components/altair_components.py,sha256=wotpFFQgMY-ZR3lNVm_fRos-iDg0Wjnj6Tk67_7f1SQ,5847
89
89
  mesa/visualization/components/matplotlib_components.py,sha256=xQETaFyHIfmL_9JwrLIgubuIQ7-pp7TMoXT1WMmozus,5441
90
- mesa-3.0.2.dist-info/METADATA,sha256=msHzQcCASIeP1Wv3W5SUyYLJiZ3GOeC5-dT1GMLlHCw,9782
91
- mesa-3.0.2.dist-info/WHEEL,sha256=3U_NnUcV_1B1kPkYaPzN-irRckL5VW_lytn0ytO_kRY,87
92
- mesa-3.0.2.dist-info/entry_points.txt,sha256=IOcQtetGF8l4wHpOs_hGb19Rz-FS__BMXOJR10IBPsA,39
93
- mesa-3.0.2.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
94
- mesa-3.0.2.dist-info/licenses/NOTICE,sha256=GbsWoK0QWv1JyZ_xer2s-jNilv0RtWl-0UrtlJANHPg,578
95
- mesa-3.0.2.dist-info/RECORD,,
90
+ mesa-3.0.3.dist-info/METADATA,sha256=B9ZoDWevYunj_DI8ztkK_TYrhWPzfJ7LVVhfgEdpY5s,9782
91
+ mesa-3.0.3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
92
+ mesa-3.0.3.dist-info/entry_points.txt,sha256=IOcQtetGF8l4wHpOs_hGb19Rz-FS__BMXOJR10IBPsA,39
93
+ mesa-3.0.3.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
94
+ mesa-3.0.3.dist-info/licenses/NOTICE,sha256=GbsWoK0QWv1JyZ_xer2s-jNilv0RtWl-0UrtlJANHPg,578
95
+ mesa-3.0.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.1
2
+ Generator: hatchling 1.26.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any