Mesa 2.3.0.dev0__tar.gz → 2.3.1__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 (144) hide show
  1. {mesa-2.3.0.dev0 → mesa-2.3.1}/.github/workflows/build_lint.yml +12 -40
  2. {mesa-2.3.0.dev0 → mesa-2.3.1}/.github/workflows/release.yml +3 -0
  3. {mesa-2.3.0.dev0 → mesa-2.3.1}/.pre-commit-config.yaml +2 -2
  4. mesa-2.3.1/CODE_OF_CONDUCT.md +131 -0
  5. {mesa-2.3.0.dev0 → mesa-2.3.1}/HISTORY.md +130 -0
  6. {mesa-2.3.0.dev0 → mesa-2.3.1}/PKG-INFO +4 -3
  7. {mesa-2.3.0.dev0 → mesa-2.3.1}/README.md +1 -1
  8. {mesa-2.3.0.dev0 → mesa-2.3.1}/benchmarks/Flocking/flocking.py +37 -38
  9. mesa-2.3.1/benchmarks/Schelling/schelling.py +109 -0
  10. mesa-2.3.1/benchmarks/WolfSheep/wolf_sheep.py +254 -0
  11. {mesa-2.3.0.dev0 → mesa-2.3.1}/benchmarks/global_benchmark.py +11 -6
  12. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/apis/api_main.md +1 -0
  13. mesa-2.3.1/docs/apis/experimental.md +60 -0
  14. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/index.md +1 -1
  15. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/intro_tutorial.ipynb +7 -7
  16. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/__init__.py +2 -1
  17. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/agent.py +2 -16
  18. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/datacollection.py +12 -6
  19. mesa-2.3.1/mesa/experimental/__init__.py +5 -0
  20. mesa-2.3.1/mesa/experimental/cell_space/__init__.py +23 -0
  21. mesa-2.3.1/mesa/experimental/cell_space/cell.py +152 -0
  22. mesa-2.3.1/mesa/experimental/cell_space/cell_agent.py +37 -0
  23. mesa-2.3.1/mesa/experimental/cell_space/cell_collection.py +81 -0
  24. mesa-2.3.1/mesa/experimental/cell_space/discrete_space.py +64 -0
  25. mesa-2.3.1/mesa/experimental/cell_space/grid.py +204 -0
  26. mesa-2.3.1/mesa/experimental/cell_space/network.py +40 -0
  27. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/experimental/components/altair.py +13 -1
  28. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/experimental/components/matplotlib.py +3 -0
  29. mesa-2.3.1/mesa/experimental/devs/__init__.py +4 -0
  30. mesa-2.3.1/mesa/experimental/devs/eventlist.py +166 -0
  31. mesa-2.3.1/mesa/experimental/devs/examples/epstein_civil_violence.py +273 -0
  32. {mesa-2.3.0.dev0/benchmarks/WolfSheep → mesa-2.3.1/mesa/experimental/devs/examples}/wolf_sheep.py +57 -28
  33. mesa-2.3.1/mesa/experimental/devs/simulator.py +293 -0
  34. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/experimental/jupyter_viz.py +51 -31
  35. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/model.py +2 -4
  36. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/space.py +27 -13
  37. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/time.py +3 -110
  38. {mesa-2.3.0.dev0 → mesa-2.3.1}/pyproject.toml +44 -40
  39. mesa-2.3.1/tests/test_cell_space.py +465 -0
  40. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_datacollector.py +1 -0
  41. mesa-2.3.1/tests/test_devs.py +282 -0
  42. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_examples.py +2 -2
  43. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_grid.py +11 -10
  44. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_jupyter_viz.py +49 -45
  45. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_space.py +24 -24
  46. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_time.py +0 -115
  47. mesa-2.3.0.dev0/CODE_OF_CONDUCT.md +0 -46
  48. mesa-2.3.0.dev0/benchmarks/Schelling/schelling.py +0 -86
  49. mesa-2.3.0.dev0/mesa/experimental/__init__.py +0 -1
  50. {mesa-2.3.0.dev0 → mesa-2.3.1}/.codespellignore +0 -0
  51. {mesa-2.3.0.dev0 → mesa-2.3.1}/.coveragerc +0 -0
  52. {mesa-2.3.0.dev0 → mesa-2.3.1}/.github/ISSUE_TEMPLATE/asking-help.md +0 -0
  53. {mesa-2.3.0.dev0 → mesa-2.3.1}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
  54. {mesa-2.3.0.dev0 → mesa-2.3.1}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  55. {mesa-2.3.0.dev0 → mesa-2.3.1}/.github/dependabot.yml +0 -0
  56. {mesa-2.3.0.dev0 → mesa-2.3.1}/.github/release.yml +0 -0
  57. {mesa-2.3.0.dev0 → mesa-2.3.1}/.github/workflows/benchmarks.yml +0 -0
  58. {mesa-2.3.0.dev0 → mesa-2.3.1}/.gitignore +0 -0
  59. {mesa-2.3.0.dev0 → mesa-2.3.1}/.readthedocs.yml +0 -0
  60. {mesa-2.3.0.dev0 → mesa-2.3.1}/CITATION.bib +0 -0
  61. {mesa-2.3.0.dev0 → mesa-2.3.1}/CONTRIBUTING.md +0 -0
  62. {mesa-2.3.0.dev0 → mesa-2.3.1}/Dockerfile +0 -0
  63. {mesa-2.3.0.dev0 → mesa-2.3.1}/LICENSE +0 -0
  64. {mesa-2.3.0.dev0 → mesa-2.3.1}/benchmarks/Flocking/__init__.py +0 -0
  65. {mesa-2.3.0.dev0 → mesa-2.3.1}/benchmarks/Schelling/__init__.py +0 -0
  66. {mesa-2.3.0.dev0 → mesa-2.3.1}/benchmarks/WolfSheep/__init__.py +0 -0
  67. {mesa-2.3.0.dev0 → mesa-2.3.1}/benchmarks/compare_timings.py +0 -0
  68. {mesa-2.3.0.dev0 → mesa-2.3.1}/benchmarks/configurations.py +0 -0
  69. {mesa-2.3.0.dev0 → mesa-2.3.1}/codecov.yaml +0 -0
  70. {mesa-2.3.0.dev0 → mesa-2.3.1}/docker-compose.yml +0 -0
  71. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/Makefile +0 -0
  72. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/README.md +0 -0
  73. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/apis/batchrunner.md +0 -0
  74. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/apis/datacollection.md +0 -0
  75. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/apis/init.md +0 -0
  76. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/apis/space.md +0 -0
  77. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/apis/time.md +0 -0
  78. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/apis/visualization.md +0 -0
  79. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/best-practices.md +0 -0
  80. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/conf.py +0 -0
  81. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/howto.md +0 -0
  82. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/Mesa_Screenshot.png +0 -0
  83. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/mesa_logo.ico +0 -0
  84. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/mesa_logo.png +0 -0
  85. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/br_ginis.png +0 -0
  86. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/dc_endwealth.png +0 -0
  87. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/dc_gini.png +0 -0
  88. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/dc_oneagent.png +0 -0
  89. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/first_hist.png +0 -0
  90. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/multirun_hist.png +0 -0
  91. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/numpy_grid.png +0 -0
  92. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/viz_chart.png +0 -0
  93. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/viz_empty.png +0 -0
  94. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/viz_greycircles.png +0 -0
  95. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/viz_histogram.png +0 -0
  96. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/images/tutorial/viz_redcircles.png +0 -0
  97. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/make.bat +0 -0
  98. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/mesa.md +0 -0
  99. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/mesa.visualization.md +0 -0
  100. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/mesa.visualization.modules.md +0 -0
  101. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/modular-visualization.md +0 -0
  102. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/overview.md +0 -0
  103. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/packages.md +0 -0
  104. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/MoneyModel.py +0 -0
  105. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/adv_tutorial_legacy.ipynb +0 -0
  106. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/files/viz_chart.png +0 -0
  107. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/files/viz_empty.png +0 -0
  108. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/files/viz_greycircles.png +0 -0
  109. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/files/viz_histogram.png +0 -0
  110. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/files/viz_redcircles.png +0 -0
  111. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/files/viz_slider.png +0 -0
  112. {mesa-2.3.0.dev0 → mesa-2.3.1}/docs/tutorials/visualization_tutorial.ipynb +0 -0
  113. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/batchrunner.py +0 -0
  114. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/cookiecutter-mesa/cookiecutter.json +0 -0
  115. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/cookiecutter-mesa/hooks/post_gen_project.py +0 -0
  116. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md +0 -0
  117. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/run.pytemplate +0 -0
  118. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate +0 -0
  119. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py +0 -0
  120. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate +0 -0
  121. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/server.pytemplate +0 -0
  122. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/experimental/UserParam.py +0 -0
  123. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/flat/__init__.py +0 -0
  124. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/flat/visualization.py +0 -0
  125. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/main.py +0 -0
  126. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/visualization/ModularVisualization.py +0 -0
  127. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/visualization/TextVisualization.py +0 -0
  128. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/visualization/UserParam.py +0 -0
  129. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/visualization/__init__.py +0 -0
  130. {mesa-2.3.0.dev0 → mesa-2.3.1}/mesa/visualization/modules.py +0 -0
  131. {mesa-2.3.0.dev0 → mesa-2.3.1}/mypy.ini +0 -0
  132. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/__init__.py +0 -0
  133. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/read_requirements.py +0 -0
  134. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_agent.py +0 -0
  135. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_batch_run.py +0 -0
  136. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_end_to_end_viz.sh +0 -0
  137. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_import_namespace.py +0 -0
  138. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_lifespan.py +0 -0
  139. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_main.py +0 -0
  140. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_model.py +0 -0
  141. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_scaffold.py +0 -0
  142. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_tornado.py +0 -0
  143. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_usersettableparam.py +0 -0
  144. {mesa-2.3.0.dev0 → mesa-2.3.1}/tests/test_visualization.py +0 -0
@@ -7,11 +7,12 @@ on:
7
7
  - release**
8
8
  paths-ignore:
9
9
  - '**.md'
10
- - '**.rst'
11
10
  pull_request:
12
11
  paths-ignore:
13
12
  - '**.md'
14
- - '**.rst'
13
+ workflow_dispatch:
14
+ schedule:
15
+ - cron: '0 6 * * 1'
15
16
 
16
17
  # This will cancel previous run if a newer job that obsoletes the said previous
17
18
  # run, is started.
@@ -48,30 +49,12 @@ jobs:
48
49
  uses: actions/setup-python@v5
49
50
  with:
50
51
  python-version: ${{ matrix.python-version }}
51
- - if: ${{ runner.os == 'Windows' }}
52
- # This is needed so that restoring cache on Windows is fast.
53
- # See until https://github.com/actions/cache/issues/752 is resolved.
54
- name: Use GNU tar
55
- shell: cmd
56
- run: |
57
- echo "Adding GNU tar to PATH"
58
- echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
59
- - uses: actions/cache@v4
60
- with:
61
- path: ${{ env.pythonLocation }}
62
- key: ${{ runner.os }}-pip-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
63
- - name: Install dependencies
64
- # Only if the cache misses
65
- # Based on https://github.com/pypa/pip/issues/8049#issuecomment-633845028
66
- # read_requirements.py should be removed once
67
- # https://github.com/pypa/pip/issues/11440 is resolved.
68
- if: steps.cache.outputs.cache-hit != 'true'
69
- run: |
70
- pip install toml
71
- python tests/read_requirements.py > requirements.txt
72
- pip install -r requirements.txt
52
+ cache: 'pip'
53
+ - name: Install uv
54
+ run: pip install uv
73
55
  - name: Install Mesa
74
- run: pip install --no-deps .
56
+ # See https://github.com/astral-sh/uv/issues/1945
57
+ run: uv pip install --system .[dev]
75
58
  - name: Test with pytest
76
59
  run: pytest --durations=10 --cov=mesa tests/ --cov-report=xml
77
60
  - if: matrix.os == 'ubuntu'
@@ -86,22 +69,11 @@ jobs:
86
69
  uses: actions/setup-python@v5
87
70
  with:
88
71
  python-version: "3.12"
89
- - uses: actions/cache@v4
90
- with:
91
- path: ${{ env.pythonLocation }}
92
- key: test-examples-pip-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
93
- - name: Install dependencies
94
- # Only if the cache misses
95
- # Based on https://github.com/pypa/pip/issues/8049#issuecomment-633845028
96
- # read_requirements.py should be removed once
97
- # https://github.com/pypa/pip/issues/11440 is resolved.
98
- if: steps.cache.outputs.cache-hit != 'true'
99
- run: |
100
- pip install toml
101
- python tests/read_requirements.py > requirements.txt
102
- pip install -r requirements.txt
72
+ cache: 'pip'
73
+ - name: Install uv
74
+ run: pip install uv
103
75
  - name: Install Mesa
104
- run: pip install --no-deps .
76
+ run: uv pip install --system .[dev]
105
77
  - name: Checkout mesa-examples
106
78
  uses: actions/checkout@v4
107
79
  with:
@@ -14,6 +14,8 @@ on:
14
14
  - '**.md'
15
15
  - '**.rst'
16
16
  workflow_dispatch:
17
+ schedule:
18
+ - cron: '0 6 * * 1'
17
19
 
18
20
  permissions:
19
21
  id-token: write
@@ -31,6 +33,7 @@ jobs:
31
33
  uses: actions/setup-python@v5
32
34
  with:
33
35
  python-version: "3.12"
36
+ cache: 'pip'
34
37
  - name: Install dependencies
35
38
  run: pip install -U pip hatch
36
39
  - name: Build distributions
@@ -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.2.0
7
+ rev: v0.3.5
8
8
  hooks:
9
9
  # Run the linter.
10
10
  - id: ruff
@@ -14,7 +14,7 @@ repos:
14
14
  - id: ruff-format
15
15
  types_or: [ python, pyi, jupyter ]
16
16
  - repo: https://github.com/asottile/pyupgrade
17
- rev: v3.15.0
17
+ rev: v3.15.2
18
18
  hooks:
19
19
  - id: pyupgrade
20
20
  args: [--py38-plus]
@@ -0,0 +1,131 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at [@jackiekazil](https://matrix.to/#/@jackiekazil:matrix.org) and/or [@edgeofchaos](https://matrix.to/#/@edgeofchaos:matrix.org). Violations posted as Github comments, discussion, etc maybe also be reported via the [report functionality](https://docs.github.com/en/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam)
63
+ All complaints will be reviewed and investigated promptly and fairly.
64
+
65
+ All community leaders are obligated to respect the privacy and security of the
66
+ reporter of any incident.
67
+
68
+ ## Enforcement Guidelines
69
+
70
+ Community leaders will follow these Community Impact Guidelines in determining
71
+ the consequences for any action they deem in violation of this Code of Conduct:
72
+
73
+ ### 1. Correction
74
+
75
+ **Community Impact**: Use of inappropriate language or other behavior deemed
76
+ unprofessional or unwelcome in the community.
77
+
78
+ **Consequence**: A private, written warning from community leaders, providing
79
+ clarity around the nature of the violation and an explanation of why the
80
+ behavior was inappropriate. A public apology may be requested.
81
+
82
+ ### 2. Warning
83
+
84
+ **Community Impact**: A violation through a single incident or series of
85
+ actions.
86
+
87
+ **Consequence**: A warning with consequences for continued behavior. No
88
+ interaction with the people involved, including unsolicited interaction with
89
+ those enforcing the Code of Conduct, for a specified period of time. This
90
+ includes avoiding interactions in community spaces as well as external channels
91
+ like social media. Violating these terms may lead to a temporary or permanent
92
+ ban.
93
+
94
+ ### 3. Temporary Ban
95
+
96
+ **Community Impact**: A serious violation of community standards, including
97
+ sustained inappropriate behavior.
98
+
99
+ **Consequence**: A temporary ban from any sort of interaction or public
100
+ communication with the community for a specified period of time. No public or
101
+ private interaction with the people involved, including unsolicited interaction
102
+ with those enforcing the Code of Conduct, is allowed during this period.
103
+ Violating these terms may lead to a permanent ban.
104
+
105
+ ### 4. Permanent Ban
106
+
107
+ **Community Impact**: Demonstrating a pattern of violation of community
108
+ standards, including sustained inappropriate behavior, harassment of an
109
+ individual, or aggression toward or disparagement of classes of individuals.
110
+
111
+ **Consequence**: A permanent ban from any sort of public interaction within the
112
+ community.
113
+
114
+ ## Attribution
115
+
116
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117
+ version 2.1, available at
118
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
119
+
120
+ Community Impact Guidelines were inspired by
121
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
122
+
123
+ For answers to common questions about this code of conduct, see the FAQ at
124
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
125
+ [https://www.contributor-covenant.org/translations][translations].
126
+
127
+ [homepage]: https://www.contributor-covenant.org
128
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
129
+ [Mozilla CoC]: https://github.com/mozilla/diversity
130
+ [FAQ]: https://www.contributor-covenant.org/faq
131
+ [translations]: https://www.contributor-covenant.org/translations
@@ -1,6 +1,136 @@
1
1
  ---
2
2
  title: Release History
3
3
  ---
4
+ # 2.3.1 (2024-07-03)
5
+ ## Highlights
6
+ Mesa 2.3.1 is a small patch release with a datacollector bug fixed and improved documentation.
7
+
8
+ ## What's Changed
9
+ ### 🐛 Bugs fixed
10
+ * datacollector: store separate snapshots of model data per step by @EwoutH in https://github.com/projectmesa/mesa/pull/2129
11
+ ### 📜 Documentation improvements
12
+ * Add experimental features to documentation as per #2122 by @stephenfmann in https://github.com/projectmesa/mesa/pull/2154
13
+
14
+ **Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.3.0...v2.3.1
15
+
16
+ # 2.3.0 (2024-04-23)
17
+ ## Highlights
18
+ Mesa 2.3.0 is a big feature release and the last feature release before 3.0.
19
+
20
+ There are two main new features:
21
+ - The experimental cell-centric discrete spaces, as added in #1994. It allows having cells with not only properties but also active behaviors: the `CellAgent`. Its inspired by NetLogo's [patches](https://ccl.northwestern.edu/netlogo/bind/primitive/patches.html) but extend and generalize this concept further.
22
+ - Full support for discrete event scheduling, as added in #2066. It allows scheduling events (like Agent actions) at any time, including non-integer timesteps.
23
+
24
+ There are a lot of other features: The Jupyter visualisation now supports easier way to specify sliders, `NetworkGrid.get_neighbors()` supports a radius, `AgentSet.get()` can retrieve multiple attributes and there are now benchmarks to track Mesa performance during development.
25
+
26
+ Finally, 2.3.0 stabilizes the `AgentSet` (including `model.agents`), making it the first experimental Mesa feature that is taken out of it's experimental phase.
27
+
28
+ Install this release with:
29
+ ```
30
+ pip install --upgrade mesa
31
+ ```
32
+ The Mesa 2.3.x-series supports Python 3.9 to 3.12. The next major release will require Python 3.10.
33
+
34
+ ## What's Changed
35
+ ### 🧪 Experimental features
36
+ * Add cell-centric discrete spaces (experimental) by @Corvince in https://github.com/projectmesa/mesa/pull/1994
37
+ ### 🎉 New features added
38
+ * Add performance benchmarking scripts by @EwoutH in https://github.com/projectmesa/mesa/pull/1979
39
+ * feat: Implement Slider class for JupyterViz by @rht in https://github.com/projectmesa/mesa/pull/1972
40
+ * Stabilize AgentSet by @EwoutH in https://github.com/projectmesa/mesa/pull/2065
41
+ * Support discrete event scheduling by @quaquel in https://github.com/projectmesa/mesa/pull/2066
42
+ ### 🛠 Enhancements made
43
+ * JupyterViz: Automatically deduce display name from model class by @rht in https://github.com/projectmesa/mesa/pull/1975
44
+ * Add radius argument to NetworkGrid.get_neighbors() by @EwoutH in https://github.com/projectmesa/mesa/pull/1973
45
+ * Speedup of Agentset.shuffle by @quaquel in https://github.com/projectmesa/mesa/pull/2010
46
+ * feat: Let mesa runserver detect server.py as fallback by @rht in https://github.com/projectmesa/mesa/pull/2015
47
+ * JupyterViz: {Convert make_plot & prepare ColorCard} to become Solara component by @rht in https://github.com/projectmesa/mesa/pull/2020
48
+ * new feature: AgentSet.get can retrieve one or more then one attribute by @quaquel in https://github.com/projectmesa/mesa/pull/2044
49
+ * Update CODE_OF_CONDUCT.md to version 2+ of contrib covenant by @jackiekazil in https://github.com/projectmesa/mesa/pull/2052
50
+ * Improve flocking benchmark by @coderbeta1 in https://github.com/projectmesa/mesa/pull/2054
51
+ * Remove JupyterViz Altair marker overlap for huge grid size by @rht in https://github.com/projectmesa/mesa/pull/2062
52
+ * Add tooltip option to Altair chart by @FoFFolo in https://github.com/projectmesa/mesa/pull/2082
53
+ * feat: Display model seed & allow user to specify it in JupyterViz by @rht in https://github.com/projectmesa/mesa/pull/2069
54
+ * warn if placing already placed agent by @puer-robustus in https://github.com/projectmesa/mesa/pull/2083
55
+ ### 🐛 Bugs fixed
56
+ * fix: Apply default value to slider by @rht in https://github.com/projectmesa/mesa/pull/2016
57
+ * fix: Initialize model _steps and _time during __new__ by @rht in https://github.com/projectmesa/mesa/pull/2026
58
+ * fix: Use model.schedule only when it is not None by @rht in https://github.com/projectmesa/mesa/pull/2050
59
+ * fix: Remove JupyterViz grid marker overlap for huge grid size by @rht in https://github.com/projectmesa/mesa/pull/2049
60
+ ### 📜 Documentation improvements
61
+ * Improve readability of badges by @rht in https://github.com/projectmesa/mesa/pull/2009
62
+ * More pythonic implementation of wolf sheep by @quaquel in https://github.com/projectmesa/mesa/pull/2011
63
+ * Adding super().__init__() to MoneyModel tutorial by @sw23 in https://github.com/projectmesa/mesa/pull/2025
64
+ * docs: Convert howto.rst -> howto.md via rst2myst by @rht in https://github.com/projectmesa/mesa/pull/2033
65
+ * docs: Convert best-practices,overview,packages,mesa,index to .md via rst2myst by @rht in https://github.com/projectmesa/mesa/pull/2034
66
+ * docs: Convert api/*.rst -> api/*.md via rst2myst by @rht in https://github.com/projectmesa/mesa/pull/2035
67
+ * docs: Rewrite howto.md using ChatGPT for clarity and conciseness by @rht in https://github.com/projectmesa/mesa/pull/2037
68
+ * docs: Corrected Contributing Guide Link to Ensure Accessibility by @sahusiddharth in https://github.com/projectmesa/mesa/pull/2057
69
+ * Rename links to internal .rst files to .md by @rht in https://github.com/projectmesa/mesa/pull/2058
70
+ * docs: improve introductory tutorial by @puer-robustus in https://github.com/projectmesa/mesa/pull/2087
71
+ ### 🔧 Maintenance
72
+ * Quality of Life: Make codecov less meticulous by @Corvince in https://github.com/projectmesa/mesa/pull/1966
73
+ * Add CI workflow for performance benchmarks by @EwoutH in https://github.com/projectmesa/mesa/pull/1983
74
+ * tests: Resolve warnings by defining PropertyLayer dtypes by @EwoutH in https://github.com/projectmesa/mesa/pull/1987
75
+ * benchmarks.yml: Fix PR branch checkout when triggered by comment by @EwoutH in https://github.com/projectmesa/mesa/pull/1998
76
+ * Quality of life: automatically fix ruff errors by @Corvince in https://github.com/projectmesa/mesa/pull/2004
77
+ * benchmarks.yml: Run on addition of label instead of comment by @EwoutH in https://github.com/projectmesa/mesa/pull/2002
78
+ * ci: Move codespell to pre-commit by @rht in https://github.com/projectmesa/mesa/pull/2040
79
+ * Schelling by @coderbeta1 in https://github.com/projectmesa/mesa/pull/2053
80
+ * Move ruff lint settings into dedicated section by @Corvince in https://github.com/projectmesa/mesa/pull/2073
81
+ * ci: Use uv pip for faster build by @rht in https://github.com/projectmesa/mesa/pull/2038
82
+ * test: Remove place_agent duplicate warnings by @rht in https://github.com/projectmesa/mesa/pull/2086
83
+ ### Other changes
84
+ * Minor edits to benchmarking code by @quaquel in https://github.com/projectmesa/mesa/pull/1985
85
+ * build(deps): bump codecov/codecov-action from 3 to 4 by @dependabot in https://github.com/projectmesa/mesa/pull/2030
86
+ * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/projectmesa/mesa/pull/2029
87
+ * tests: Speed up test_batch_run by @rht in https://github.com/projectmesa/mesa/pull/2039
88
+ * Update benchmarks.yml by @Corvince in https://github.com/projectmesa/mesa/pull/2043
89
+ * docs: Convert visualization .rst -> .md via rst2myst by @rht in https://github.com/projectmesa/mesa/pull/2036
90
+ * docs: Convert CONTRIBUTING .rst -> .md via rst2myst by @rht in https://github.com/projectmesa/mesa/pull/2041
91
+ * Correct wolf energy gained from eating sheep by @JackAtOmenApps in https://github.com/projectmesa/mesa/pull/2048
92
+ * feat: Implement Altair version of grid visualization by @rht in https://github.com/projectmesa/mesa/pull/1991
93
+
94
+ ## New Contributors
95
+ * @sw23 made their first contribution in https://github.com/projectmesa/mesa/pull/2025
96
+ * @JackAtOmenApps made their first contribution in https://github.com/projectmesa/mesa/pull/2048
97
+ * @coderbeta1 made their first contribution in https://github.com/projectmesa/mesa/pull/2054
98
+ * @sahusiddharth made their first contribution in https://github.com/projectmesa/mesa/pull/2057
99
+ * @FoFFolo made their first contribution in https://github.com/projectmesa/mesa/pull/2082
100
+ * @puer-robustus made their first contribution in https://github.com/projectmesa/mesa/pull/2083
101
+
102
+ **Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.2.4...2.3.0
103
+
104
+ # 2.3.0-rc1 (2024-04-18)
105
+ Mesa 2.3.0-rc1 is pre-release in preparation for 2.3.0 stable. It had the same release notes as 2.3.0.
106
+
107
+ # 2.2.4 (2024-01-26)
108
+ ## Highlights
109
+ Mesa v2.2.4 is a small but important bugfix release for the 2.2 release series. It fixes an essential bug in where agents weren't shuffled in the `BaseScheduler`, affecting mainly the `RandomActivation` scheduler (effectively making it sequential activation)([#2007](https://github.com/projectmesa/mesa/pull/2007)). It also fixes a small behaviour change in `RandomActivationByType.agents_by_type()` ([#1996](https://github.com/projectmesa/mesa/pull/1996)). Furthermore, this release adds an internal clock to the `Model`, which allows to use a Mesa model without a scheduler (using the `AgentSet` API)([#1942](https://github.com/projectmesa/mesa/pull/1942)).
110
+
111
+ Updating from previous 2.2 releases is highly recommended, especially when using the `RandomActivation` scheduler.
112
+
113
+ ## What's Changed
114
+ ### 🛠 Enhancements made
115
+ * refactor: Remove dependence on model.schedule, add clock to Model by @rht in https://github.com/projectmesa/mesa/pull/1942
116
+ ### 🐛 Bugs fixed
117
+ * Fix AgentSet inplace shuffle (and thus RandomActivation), add tests by @EwoutH and @quaquel in https://github.com/projectmesa/mesa/pull/2007
118
+ * fix: Reverse dict key and value for agents_by_type by @rht in https://github.com/projectmesa/mesa/pull/1996
119
+
120
+ **Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.2.3...v2.2.4
121
+
122
+ # 2.2.3 (2024-01-22)
123
+ ## Highlights
124
+ Mesa 2.2.3 is a small release with two improvements to the experimental Solara visualisation, on request of one of our contributors. No stable features have changed.
125
+
126
+ ## What's Changed
127
+ ### 🧪 Experimental features
128
+ * solara_viz: Add borders around ContinuousSpace by @EwoutH in https://github.com/projectmesa/mesa/pull/1988
129
+ ### 🐛 Bugs fixed
130
+ * fix: Explicitly specify JupyterViz space view limits by @rht in https://github.com/projectmesa/mesa/pull/1984
131
+
132
+ **Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.2.2...v2.2.3
133
+
4
134
  # 2.2.2 (2024-01-22)
5
135
 
6
136
  ## Highlights
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: Mesa
3
- Version: 2.3.0.dev0
3
+ Version: 2.3.1
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
@@ -34,6 +34,7 @@ Requires-Dist: tqdm
34
34
  Provides-Extra: dev
35
35
  Requires-Dist: coverage; extra == 'dev'
36
36
  Requires-Dist: pytest-cov; extra == 'dev'
37
+ Requires-Dist: pytest-mock; extra == 'dev'
37
38
  Requires-Dist: pytest>=4.6; extra == 'dev'
38
39
  Requires-Dist: ruff~=0.1.1; extra == 'dev'
39
40
  Requires-Dist: sphinx; extra == 'dev'
@@ -162,7 +163,7 @@ If you would like to add a feature, please reach out via [ticket](https://github
162
163
  join a dev session (see [Mesa discussions](https://github.com/projectmesa/mesa/discussions)). A feature is most likely
163
164
  to be added if you build it!
164
165
 
165
- Don't forget to checkout the [Contributors guide](https://github.com/projectmesa/mesa/blob/main/CONTRIBUTING.rst).
166
+ Don't forget to checkout the [Contributors guide](https://github.com/projectmesa/mesa/blob/main/CONTRIBUTING.md).
166
167
 
167
168
  ## Citing Mesa
168
169
 
@@ -114,7 +114,7 @@ If you would like to add a feature, please reach out via [ticket](https://github
114
114
  join a dev session (see [Mesa discussions](https://github.com/projectmesa/mesa/discussions)). A feature is most likely
115
115
  to be added if you build it!
116
116
 
117
- Don't forget to checkout the [Contributors guide](https://github.com/projectmesa/mesa/blob/main/CONTRIBUTING.rst).
117
+ Don't forget to checkout the [Contributors guide](https://github.com/projectmesa/mesa/blob/main/CONTRIBUTING.md).
118
118
 
119
119
  ## Citing Mesa
120
120
 
@@ -20,7 +20,7 @@ class Boid(mesa.Agent):
20
20
  - Alignment: try to fly in the same direction as the neighbors.
21
21
 
22
22
  Boids have a vision that defines the radius in which they look for their
23
- neighbors to flock with. Their speed (a scalar) and velocity (a vector)
23
+ neighbors to flock with. Their speed (a scalar) and direction (a vector)
24
24
  define their movement. Separation is their desired minimum distance from
25
25
  any other Boid.
26
26
  """
@@ -29,9 +29,8 @@ class Boid(mesa.Agent):
29
29
  self,
30
30
  unique_id,
31
31
  model,
32
- pos,
33
32
  speed,
34
- velocity,
33
+ direction,
35
34
  vision,
36
35
  separation,
37
36
  cohere=0.03,
@@ -43,20 +42,18 @@ class Boid(mesa.Agent):
43
42
 
44
43
  Args:
45
44
  unique_id: Unique agent identifier.
46
- pos: Starting position
47
45
  speed: Distance to move per step.
48
- heading: numpy vector for the Boid's direction of movement.
46
+ direction: numpy vector for the Boid's direction of movement.
49
47
  vision: Radius to look around for nearby Boids.
50
48
  separation: Minimum distance to maintain from other Boids.
51
49
  cohere: the relative importance of matching neighbors' positions
52
50
  separate: the relative importance of avoiding close neighbors
53
- match: the relative importance of matching neighbors' headings
51
+ match: the relative importance of matching neighbors' directions
54
52
 
55
53
  """
56
54
  super().__init__(unique_id, model)
57
- self.pos = np.array(pos)
58
55
  self.speed = speed
59
- self.velocity = velocity
56
+ self.direction = direction
60
57
  self.vision = vision
61
58
  self.separation = separation
62
59
  self.cohere_factor = cohere
@@ -77,14 +74,14 @@ class Boid(mesa.Agent):
77
74
  cohere += heading
78
75
  if self.model.space.get_distance(self.pos, neighbor.pos) < self.separation:
79
76
  separation_vector -= heading
80
- match_vector += neighbor.velocity
77
+ match_vector += neighbor.direction
81
78
  n = max(n, 1)
82
79
  cohere = cohere * self.cohere_factor
83
80
  separation_vector = separation_vector * self.separate_factor
84
81
  match_vector = match_vector * self.match_factor
85
- self.velocity += (cohere + separation_vector + match_vector) / n
86
- self.velocity /= np.linalg.norm(self.velocity)
87
- new_pos = self.pos + self.velocity * self.speed
82
+ self.direction += (cohere + separation_vector + match_vector) / n
83
+ self.direction /= np.linalg.norm(self.direction)
84
+ new_pos = self.pos + self.direction * self.speed
88
85
  self.model.space.move_agent(self, new_pos)
89
86
 
90
87
 
@@ -95,16 +92,17 @@ class BoidFlockers(mesa.Model):
95
92
 
96
93
  def __init__(
97
94
  self,
98
- seed,
99
- population,
100
- width,
101
- height,
102
- vision,
95
+ seed=None,
96
+ population=100,
97
+ width=100,
98
+ height=100,
99
+ vision=10,
103
100
  speed=1,
104
101
  separation=1,
105
102
  cohere=0.03,
106
103
  separate=0.015,
107
104
  match=0.05,
105
+ simulator=None,
108
106
  ):
109
107
  """
110
108
  Create a new Flockers model.
@@ -117,34 +115,35 @@ class BoidFlockers(mesa.Model):
117
115
  separation: What's the minimum distance each Boid will attempt to
118
116
  keep from any other
119
117
  cohere, separate, match: factors for the relative importance of
120
- the three drives."""
118
+ the three drives.
119
+ """
121
120
  super().__init__(seed=seed)
122
121
  self.population = population
123
- self.vision = vision
124
- self.speed = speed
125
- self.separation = separation
122
+ self.width = width
123
+ self.height = height
124
+ self.simulator = simulator
125
+
126
126
  self.schedule = mesa.time.RandomActivation(self)
127
- self.space = mesa.space.ContinuousSpace(width, height, True)
128
- self.factors = {"cohere": cohere, "separate": separate, "match": match}
129
- self.make_agents()
127
+ self.space = mesa.space.ContinuousSpace(self.width, self.height, True)
128
+ self.factors = {
129
+ "cohere": cohere,
130
+ "separate": separate,
131
+ "match": match,
132
+ }
130
133
 
131
- def make_agents(self):
132
- """
133
- Create self.population agents, with random positions and starting headings.
134
- """
135
134
  for i in range(self.population):
136
135
  x = self.random.random() * self.space.x_max
137
136
  y = self.random.random() * self.space.y_max
138
137
  pos = np.array((x, y))
139
- velocity = np.random.random(2) * 2 - 1
138
+ direction = np.random.random(2) * 2 - 1
140
139
  boid = Boid(
141
- i,
142
- self,
143
- pos,
144
- self.speed,
145
- velocity,
146
- self.vision,
147
- self.separation,
140
+ unique_id=i,
141
+ model=self,
142
+ pos=pos,
143
+ speed=speed,
144
+ direction=direction,
145
+ vision=vision,
146
+ separation=separation,
148
147
  **self.factors,
149
148
  )
150
149
  self.space.place_agent(boid, pos)
@@ -157,8 +156,8 @@ class BoidFlockers(mesa.Model):
157
156
  if __name__ == "__main__":
158
157
  import time
159
158
 
160
- # model = BoidFlockers(15, 200, 100, 100, 5)
161
- model = BoidFlockers(15, 400, 100, 100, 15)
159
+ # model = BoidFlockers(seed=15, population=200, width=100, height=100, vision=5)
160
+ model = BoidFlockers(seed=15, population=400, width=100, height=100, vision=15)
162
161
 
163
162
  start_time = time.perf_counter()
164
163
  for _ in range(100):