modelly-abm 1.0.0__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.
Files changed (352) hide show
  1. modelly_abm-1.0.0/.coderabbit.yaml +137 -0
  2. modelly_abm-1.0.0/.gitattributes +23 -0
  3. modelly_abm-1.0.0/.github/CODEOWNERS +11 -0
  4. modelly_abm-1.0.0/.github/ISSUE_TEMPLATE/bug-report.md +22 -0
  5. modelly_abm-1.0.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  6. modelly_abm-1.0.0/.github/ISSUE_TEMPLATE/feature-request.md +17 -0
  7. modelly_abm-1.0.0/.github/PULL_REQUEST_TEMPLATE/bug.md +23 -0
  8. modelly_abm-1.0.0/.github/PULL_REQUEST_TEMPLATE/feature.md +25 -0
  9. modelly_abm-1.0.0/.github/dependabot.yml +8 -0
  10. modelly_abm-1.0.0/.github/pull_request_template.md +6 -0
  11. modelly_abm-1.0.0/.github/release.yml +43 -0
  12. modelly_abm-1.0.0/.github/styles/Modelly/README.md +75 -0
  13. modelly_abm-1.0.0/.github/styles/Modelly/modelly.yml +14 -0
  14. modelly_abm-1.0.0/.github/workflows/benchmarks-comment.yml +37 -0
  15. modelly_abm-1.0.0/.github/workflows/benchmarks.yml +85 -0
  16. modelly_abm-1.0.0/.github/workflows/build_lint.yml +101 -0
  17. modelly_abm-1.0.0/.github/workflows/docs.yml +50 -0
  18. modelly_abm-1.0.0/.github/workflows/label_automatiom_issue.yml +82 -0
  19. modelly_abm-1.0.0/.github/workflows/label_automation_pr.yml +113 -0
  20. modelly_abm-1.0.0/.github/workflows/release.yml +96 -0
  21. modelly_abm-1.0.0/.github/workflows/vale.yml +44 -0
  22. modelly_abm-1.0.0/.gitignore +153 -0
  23. modelly_abm-1.0.0/.pre-commit-config.yaml +64 -0
  24. modelly_abm-1.0.0/.readthedocs.yml +26 -0
  25. modelly_abm-1.0.0/.vale.ini +38 -0
  26. modelly_abm-1.0.0/CHANGELOG.md +65 -0
  27. modelly_abm-1.0.0/CITATION.cff +26 -0
  28. modelly_abm-1.0.0/CODE_OF_CONDUCT.md +117 -0
  29. modelly_abm-1.0.0/CONTRIBUTING.md +211 -0
  30. modelly_abm-1.0.0/LICENSE +201 -0
  31. modelly_abm-1.0.0/NOTICE +30 -0
  32. modelly_abm-1.0.0/PKG-INFO +663 -0
  33. modelly_abm-1.0.0/README.md +556 -0
  34. modelly_abm-1.0.0/SECURITY.md +24 -0
  35. modelly_abm-1.0.0/benchmarks/README.md +103 -0
  36. modelly_abm-1.0.0/benchmarks/compare_timings.py +98 -0
  37. modelly_abm-1.0.0/benchmarks/configurations.py +145 -0
  38. modelly_abm-1.0.0/benchmarks/global_benchmark.py +112 -0
  39. modelly_abm-1.0.0/benchmarks/mesa_baseline/README.md +153 -0
  40. modelly_abm-1.0.0/benchmarks/mesa_baseline/open_lab.sh +97 -0
  41. modelly_abm-1.0.0/benchmarks/mesa_baseline/run_baseline.py +256 -0
  42. modelly_abm-1.0.0/benchmarks/notebooks/flocking_continuous.ipynb +277 -0
  43. modelly_abm-1.0.0/benchmarks/notebooks/grid_epidemic.ipynb +272 -0
  44. modelly_abm-1.0.0/benchmarks/notebooks/make_notebooks.py +254 -0
  45. modelly_abm-1.0.0/benchmarks/notebooks/network_diffusion.ipynb +221 -0
  46. modelly_abm-1.0.0/benchmarks/notebooks/predator_prey_lifecycle.ipynb +223 -0
  47. modelly_abm-1.0.0/benchmarks/notebooks/results/README.md +37 -0
  48. modelly_abm-1.0.0/benchmarks/notebooks/results/flocking_continuous.json +35 -0
  49. modelly_abm-1.0.0/benchmarks/notebooks/results/grid_epidemic.json +23 -0
  50. modelly_abm-1.0.0/benchmarks/notebooks/results/network_diffusion.json +23 -0
  51. modelly_abm-1.0.0/benchmarks/notebooks/results/predator_prey_lifecycle.json +23 -0
  52. modelly_abm-1.0.0/benchmarks/notebooks/run_notebooks.py +91 -0
  53. modelly_abm-1.0.0/benchmarks/playbooks/README.md +67 -0
  54. modelly_abm-1.0.0/benchmarks/playbooks/compare.py +259 -0
  55. modelly_abm-1.0.0/benchmarks/playbooks/flocking/mesa_model.py +98 -0
  56. modelly_abm-1.0.0/benchmarks/playbooks/flocking/modelly_model.py +100 -0
  57. modelly_abm-1.0.0/benchmarks/playbooks/grid_epidemic/mesa_model.py +94 -0
  58. modelly_abm-1.0.0/benchmarks/playbooks/grid_epidemic/modelly_cells.py +89 -0
  59. modelly_abm-1.0.0/benchmarks/playbooks/grid_epidemic/modelly_model.py +86 -0
  60. modelly_abm-1.0.0/benchmarks/playbooks/insect_cohorts/mesa_model.py +166 -0
  61. modelly_abm-1.0.0/benchmarks/playbooks/insect_cohorts/modelly_cohorts.py +157 -0
  62. modelly_abm-1.0.0/benchmarks/playbooks/insect_cohorts/modelly_model.py +140 -0
  63. modelly_abm-1.0.0/benchmarks/playbooks/network_contagion/mesa_model.py +87 -0
  64. modelly_abm-1.0.0/benchmarks/playbooks/network_contagion/modelly_model.py +81 -0
  65. modelly_abm-1.0.0/benchmarks/playbooks/predator_prey/mesa_model.py +174 -0
  66. modelly_abm-1.0.0/benchmarks/playbooks/predator_prey/modelly_cells.py +161 -0
  67. modelly_abm-1.0.0/benchmarks/playbooks/predator_prey/modelly_model.py +170 -0
  68. modelly_abm-1.0.0/benchmarks/playbooks/registry.py +98 -0
  69. modelly_abm-1.0.0/benchmarks/playbooks/results/README.md +102 -0
  70. modelly_abm-1.0.0/benchmarks/playbooks/results/flocking.json +78 -0
  71. modelly_abm-1.0.0/benchmarks/playbooks/results/grid_epidemic.json +156 -0
  72. modelly_abm-1.0.0/benchmarks/playbooks/results/insect_cohorts.json +156 -0
  73. modelly_abm-1.0.0/benchmarks/playbooks/results/network_contagion.json +114 -0
  74. modelly_abm-1.0.0/benchmarks/playbooks/results/predator_prey.json +139 -0
  75. modelly_abm-1.0.0/benchmarks/playbooks/worker.py +56 -0
  76. modelly_abm-1.0.0/binder/environment.yml +16 -0
  77. modelly_abm-1.0.0/codecov.yaml +12 -0
  78. modelly_abm-1.0.0/docs/Makefile +177 -0
  79. modelly_abm-1.0.0/docs/README.md +37 -0
  80. modelly_abm-1.0.0/docs/_static/landing-sims.js +299 -0
  81. modelly_abm-1.0.0/docs/_static/landing.css +215 -0
  82. modelly_abm-1.0.0/docs/_static/landing.js +128 -0
  83. modelly_abm-1.0.0/docs/_static/modelly-mark.svg +14 -0
  84. modelly_abm-1.0.0/docs/_static/modelly.css +234 -0
  85. modelly_abm-1.0.0/docs/_static/switcher.json +7 -0
  86. modelly_abm-1.0.0/docs/_templates/version-pill.html +2 -0
  87. modelly_abm-1.0.0/docs/apis/agent.md +8 -0
  88. modelly_abm-1.0.0/docs/apis/agentset.md +8 -0
  89. modelly_abm-1.0.0/docs/apis/api_main.md +21 -0
  90. modelly_abm-1.0.0/docs/apis/batch.md +10 -0
  91. modelly_abm-1.0.0/docs/apis/cohorts.md +10 -0
  92. modelly_abm-1.0.0/docs/apis/columns.md +17 -0
  93. modelly_abm-1.0.0/docs/apis/datacollection.md +15 -0
  94. modelly_abm-1.0.0/docs/apis/discrete_space.md +62 -0
  95. modelly_abm-1.0.0/docs/apis/experimental.md +50 -0
  96. modelly_abm-1.0.0/docs/apis/log.md +7 -0
  97. modelly_abm-1.0.0/docs/apis/meta_agents.md +91 -0
  98. modelly_abm-1.0.0/docs/apis/migrate.md +9 -0
  99. modelly_abm-1.0.0/docs/apis/model.md +7 -0
  100. modelly_abm-1.0.0/docs/apis/rng.md +13 -0
  101. modelly_abm-1.0.0/docs/apis/time.md +7 -0
  102. modelly_abm-1.0.0/docs/apis/visualization.md +156 -0
  103. modelly_abm-1.0.0/docs/best-practices.md +76 -0
  104. modelly_abm-1.0.0/docs/conf.py +440 -0
  105. modelly_abm-1.0.0/docs/example_template.txt +22 -0
  106. modelly_abm-1.0.0/docs/examples_overview_template.txt +13 -0
  107. modelly_abm-1.0.0/docs/getting_started.md +50 -0
  108. modelly_abm-1.0.0/docs/images/Discrete_Space.drawio.png +0 -0
  109. modelly_abm-1.0.0/docs/images/branding/architecture-dark.svg +173 -0
  110. modelly_abm-1.0.0/docs/images/branding/architecture-light.svg +173 -0
  111. modelly_abm-1.0.0/docs/images/branding/banner-dark.svg +106 -0
  112. modelly_abm-1.0.0/docs/images/branding/banner-light.svg +106 -0
  113. modelly_abm-1.0.0/docs/images/branding/simulation-loop-dark.svg +24 -0
  114. modelly_abm-1.0.0/docs/images/branding/simulation-loop-light.svg +24 -0
  115. modelly_abm-1.0.0/docs/images/branding/social-preview.png +0 -0
  116. modelly_abm-1.0.0/docs/images/modelly_logo.ico +0 -0
  117. modelly_abm-1.0.0/docs/images/modelly_logo.png +0 -0
  118. modelly_abm-1.0.0/docs/images/wolf_sheep.png +0 -0
  119. modelly_abm-1.0.0/docs/index.md +183 -0
  120. modelly_abm-1.0.0/docs/lint.md +109 -0
  121. modelly_abm-1.0.0/docs/make.bat +242 -0
  122. modelly_abm-1.0.0/docs/migrating_from_mesa.md +186 -0
  123. modelly_abm-1.0.0/docs/overview.md +334 -0
  124. modelly_abm-1.0.0/docs/performance.md +418 -0
  125. modelly_abm-1.0.0/docs/tutorials/0_first_model.ipynb +611 -0
  126. modelly_abm-1.0.0/docs/tutorials/10_visualization_custom.ipynb +424 -0
  127. modelly_abm-1.0.0/docs/tutorials/11_discrete_event_simulation.ipynb +1152 -0
  128. modelly_abm-1.0.0/docs/tutorials/12_hybrid_abm_devs.ipynb +1508 -0
  129. modelly_abm-1.0.0/docs/tutorials/1_agentset.ipynb +720 -0
  130. modelly_abm-1.0.0/docs/tutorials/2_agent_activation.ipynb +624 -0
  131. modelly_abm-1.0.0/docs/tutorials/3_event_scheduling.ipynb +836 -0
  132. modelly_abm-1.0.0/docs/tutorials/4_adding_space.ipynb +389 -0
  133. modelly_abm-1.0.0/docs/tutorials/5_collecting_data.ipynb +529 -0
  134. modelly_abm-1.0.0/docs/tutorials/6_visualization_basic.ipynb +419 -0
  135. modelly_abm-1.0.0/docs/tutorials/7_visualization_dynamic_agents.ipynb +383 -0
  136. modelly_abm-1.0.0/docs/tutorials/8_visualization_rendering_with_space_renderer.ipynb +574 -0
  137. modelly_abm-1.0.0/docs/tutorials/9_visualization_property_layer_visualization.ipynb +536 -0
  138. modelly_abm-1.0.0/docs/using_modelly_in_your_project.md +370 -0
  139. modelly_abm-1.0.0/docs/vectorised_phases.md +168 -0
  140. modelly_abm-1.0.0/example.py +65 -0
  141. modelly_abm-1.0.0/hatch_build.py +74 -0
  142. modelly_abm-1.0.0/modelly/__init__.py +37 -0
  143. modelly_abm-1.0.0/modelly/_native/__init__.py +0 -0
  144. modelly_abm-1.0.0/modelly/_native/fastrng.c +347 -0
  145. modelly_abm-1.0.0/modelly/agent.py +282 -0
  146. modelly_abm-1.0.0/modelly/agentset/__init__.py +36 -0
  147. modelly_abm-1.0.0/modelly/agentset/_utils.py +132 -0
  148. modelly_abm-1.0.0/modelly/agentset/abstract.py +352 -0
  149. modelly_abm-1.0.0/modelly/agentset/groupby.py +142 -0
  150. modelly_abm-1.0.0/modelly/agentset/selection.py +163 -0
  151. modelly_abm-1.0.0/modelly/agentset/strong.py +160 -0
  152. modelly_abm-1.0.0/modelly/agentset/weak.py +274 -0
  153. modelly_abm-1.0.0/modelly/batch.py +140 -0
  154. modelly_abm-1.0.0/modelly/cohorts.py +198 -0
  155. modelly_abm-1.0.0/modelly/column_access.py +81 -0
  156. modelly_abm-1.0.0/modelly/columns.py +301 -0
  157. modelly_abm-1.0.0/modelly/datacollection.py +394 -0
  158. modelly_abm-1.0.0/modelly/discrete_space/__init__.py +55 -0
  159. modelly_abm-1.0.0/modelly/discrete_space/base_grid.py +325 -0
  160. modelly_abm-1.0.0/modelly/discrete_space/cell.py +317 -0
  161. modelly_abm-1.0.0/modelly/discrete_space/cell_agent.py +226 -0
  162. modelly_abm-1.0.0/modelly/discrete_space/cell_collection.py +189 -0
  163. modelly_abm-1.0.0/modelly/discrete_space/cell_index.py +138 -0
  164. modelly_abm-1.0.0/modelly/discrete_space/discrete_space.py +302 -0
  165. modelly_abm-1.0.0/modelly/discrete_space/grid.py +230 -0
  166. modelly_abm-1.0.0/modelly/discrete_space/network.py +181 -0
  167. modelly_abm-1.0.0/modelly/discrete_space/occupancy.py +113 -0
  168. modelly_abm-1.0.0/modelly/discrete_space/property_layer.py +146 -0
  169. modelly_abm-1.0.0/modelly/discrete_space/voronoi.py +315 -0
  170. modelly_abm-1.0.0/modelly/examples/README.md +54 -0
  171. modelly_abm-1.0.0/modelly/examples/__init__.py +25 -0
  172. modelly_abm-1.0.0/modelly/examples/advanced/__init__.py +0 -0
  173. modelly_abm-1.0.0/modelly/examples/advanced/alliance_formation/Readme.md +45 -0
  174. modelly_abm-1.0.0/modelly/examples/advanced/alliance_formation/__init__.py +0 -0
  175. modelly_abm-1.0.0/modelly/examples/advanced/alliance_formation/agents.py +20 -0
  176. modelly_abm-1.0.0/modelly/examples/advanced/alliance_formation/app.py +83 -0
  177. modelly_abm-1.0.0/modelly/examples/advanced/alliance_formation/model.py +201 -0
  178. modelly_abm-1.0.0/modelly/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +116 -0
  179. modelly_abm-1.0.0/modelly/examples/advanced/epstein_civil_violence/Readme.md +38 -0
  180. modelly_abm-1.0.0/modelly/examples/advanced/epstein_civil_violence/__init__.py +0 -0
  181. modelly_abm-1.0.0/modelly/examples/advanced/epstein_civil_violence/agents.py +140 -0
  182. modelly_abm-1.0.0/modelly/examples/advanced/epstein_civil_violence/app.py +92 -0
  183. modelly_abm-1.0.0/modelly/examples/advanced/epstein_civil_violence/model.py +125 -0
  184. modelly_abm-1.0.0/modelly/examples/advanced/pd_grid/Readme.md +45 -0
  185. modelly_abm-1.0.0/modelly/examples/advanced/pd_grid/__init__.py +0 -0
  186. modelly_abm-1.0.0/modelly/examples/advanced/pd_grid/agents.py +48 -0
  187. modelly_abm-1.0.0/modelly/examples/advanced/pd_grid/analysis.ipynb +183 -0
  188. modelly_abm-1.0.0/modelly/examples/advanced/pd_grid/app.py +62 -0
  189. modelly_abm-1.0.0/modelly/examples/advanced/pd_grid/model.py +89 -0
  190. modelly_abm-1.0.0/modelly/examples/advanced/sugarscape_g1mt/Readme.md +71 -0
  191. modelly_abm-1.0.0/modelly/examples/advanced/sugarscape_g1mt/__init__.py +0 -0
  192. modelly_abm-1.0.0/modelly/examples/advanced/sugarscape_g1mt/agents.py +301 -0
  193. modelly_abm-1.0.0/modelly/examples/advanced/sugarscape_g1mt/app.py +82 -0
  194. modelly_abm-1.0.0/modelly/examples/advanced/sugarscape_g1mt/model.py +134 -0
  195. modelly_abm-1.0.0/modelly/examples/advanced/sugarscape_g1mt/sugar-map.txt +50 -0
  196. modelly_abm-1.0.0/modelly/examples/advanced/wolf_sheep/Readme.md +46 -0
  197. modelly_abm-1.0.0/modelly/examples/advanced/wolf_sheep/__init__.py +0 -0
  198. modelly_abm-1.0.0/modelly/examples/advanced/wolf_sheep/agents.py +154 -0
  199. modelly_abm-1.0.0/modelly/examples/advanced/wolf_sheep/app.py +92 -0
  200. modelly_abm-1.0.0/modelly/examples/advanced/wolf_sheep/model.py +146 -0
  201. modelly_abm-1.0.0/modelly/examples/basic/__init__.py +0 -0
  202. modelly_abm-1.0.0/modelly/examples/basic/boid_flockers/Readme.md +31 -0
  203. modelly_abm-1.0.0/modelly/examples/basic/boid_flockers/__init__.py +0 -0
  204. modelly_abm-1.0.0/modelly/examples/basic/boid_flockers/agents.py +93 -0
  205. modelly_abm-1.0.0/modelly/examples/basic/boid_flockers/app.py +88 -0
  206. modelly_abm-1.0.0/modelly/examples/basic/boid_flockers/model.py +123 -0
  207. modelly_abm-1.0.0/modelly/examples/basic/boltzmann_wealth_model/Readme.md +63 -0
  208. modelly_abm-1.0.0/modelly/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
  209. modelly_abm-1.0.0/modelly/examples/basic/boltzmann_wealth_model/agents.py +48 -0
  210. modelly_abm-1.0.0/modelly/examples/basic/boltzmann_wealth_model/app.py +99 -0
  211. modelly_abm-1.0.0/modelly/examples/basic/boltzmann_wealth_model/model.py +97 -0
  212. modelly_abm-1.0.0/modelly/examples/basic/boltzmann_wealth_model/st_app.py +117 -0
  213. modelly_abm-1.0.0/modelly/examples/basic/conways_game_of_life/Readme.md +38 -0
  214. modelly_abm-1.0.0/modelly/examples/basic/conways_game_of_life/__init__.py +0 -0
  215. modelly_abm-1.0.0/modelly/examples/basic/conways_game_of_life/agents.py +55 -0
  216. modelly_abm-1.0.0/modelly/examples/basic/conways_game_of_life/app.py +73 -0
  217. modelly_abm-1.0.0/modelly/examples/basic/conways_game_of_life/model.py +36 -0
  218. modelly_abm-1.0.0/modelly/examples/basic/conways_game_of_life/st_app.py +73 -0
  219. modelly_abm-1.0.0/modelly/examples/basic/schelling/Readme.md +37 -0
  220. modelly_abm-1.0.0/modelly/examples/basic/schelling/__init__.py +0 -0
  221. modelly_abm-1.0.0/modelly/examples/basic/schelling/agents.py +47 -0
  222. modelly_abm-1.0.0/modelly/examples/basic/schelling/app.py +93 -0
  223. modelly_abm-1.0.0/modelly/examples/basic/schelling/model.py +93 -0
  224. modelly_abm-1.0.0/modelly/examples/basic/schelling/resources/blue_happy.png +0 -0
  225. modelly_abm-1.0.0/modelly/examples/basic/schelling/resources/blue_unhappy.png +0 -0
  226. modelly_abm-1.0.0/modelly/examples/basic/schelling/resources/orange_happy.png +0 -0
  227. modelly_abm-1.0.0/modelly/examples/basic/schelling/resources/orange_unhappy.png +0 -0
  228. modelly_abm-1.0.0/modelly/examples/basic/virus_on_network/Readme.md +44 -0
  229. modelly_abm-1.0.0/modelly/examples/basic/virus_on_network/__init__.py +0 -0
  230. modelly_abm-1.0.0/modelly/examples/basic/virus_on_network/agents.py +65 -0
  231. modelly_abm-1.0.0/modelly/examples/basic/virus_on_network/app.py +140 -0
  232. modelly_abm-1.0.0/modelly/examples/basic/virus_on_network/model.py +92 -0
  233. modelly_abm-1.0.0/modelly/examples/experimental/__init__.py +0 -0
  234. modelly_abm-1.0.0/modelly/examples/experimental/tram_model/Readme.md +67 -0
  235. modelly_abm-1.0.0/modelly/examples/experimental/tram_model/__init__.py +0 -0
  236. modelly_abm-1.0.0/modelly/examples/experimental/tram_model/agents.py +158 -0
  237. modelly_abm-1.0.0/modelly/examples/experimental/tram_model/app.py +65 -0
  238. modelly_abm-1.0.0/modelly/examples/experimental/tram_model/model.py +116 -0
  239. modelly_abm-1.0.0/modelly/examples/experimental/tram_model/utils.py +223 -0
  240. modelly_abm-1.0.0/modelly/exceptions.py +92 -0
  241. modelly_abm-1.0.0/modelly/experimental/__init__.py +18 -0
  242. modelly_abm-1.0.0/modelly/experimental/actions/__init__.py +9 -0
  243. modelly_abm-1.0.0/modelly/experimental/actions/actions.py +721 -0
  244. modelly_abm-1.0.0/modelly/experimental/continuous_space/__init__.py +19 -0
  245. modelly_abm-1.0.0/modelly/experimental/continuous_space/continuous_space.py +341 -0
  246. modelly_abm-1.0.0/modelly/experimental/continuous_space/continuous_space_agents.py +93 -0
  247. modelly_abm-1.0.0/modelly/experimental/continuous_space/vectorised.py +64 -0
  248. modelly_abm-1.0.0/modelly/experimental/data_collection/__init__.py +32 -0
  249. modelly_abm-1.0.0/modelly/experimental/data_collection/basedatarecorder.py +303 -0
  250. modelly_abm-1.0.0/modelly/experimental/data_collection/datarecorders.py +693 -0
  251. modelly_abm-1.0.0/modelly/experimental/data_collection/dataset.py +628 -0
  252. modelly_abm-1.0.0/modelly/experimental/meta_agents/__init__.py +9 -0
  253. modelly_abm-1.0.0/modelly/experimental/meta_agents/backend.py +135 -0
  254. modelly_abm-1.0.0/modelly/experimental/meta_agents/meta_agent.py +191 -0
  255. modelly_abm-1.0.0/modelly/experimental/meta_agents/meta_agents_api.py +459 -0
  256. modelly_abm-1.0.0/modelly/experimental/scenarios/__init__.py +27 -0
  257. modelly_abm-1.0.0/modelly/experimental/scenarios/exceptions.py +210 -0
  258. modelly_abm-1.0.0/modelly/experimental/scenarios/runner.py +280 -0
  259. modelly_abm-1.0.0/modelly/experimental/scenarios/scenario.py +344 -0
  260. modelly_abm-1.0.0/modelly/experimental/scenarios/store.py +257 -0
  261. modelly_abm-1.0.0/modelly/experimental/signals/__init__.py +37 -0
  262. modelly_abm-1.0.0/modelly/experimental/signals/batching.py +275 -0
  263. modelly_abm-1.0.0/modelly/experimental/signals/core.py +775 -0
  264. modelly_abm-1.0.0/modelly/experimental/signals/observable_collections.py +192 -0
  265. modelly_abm-1.0.0/modelly/experimental/signals/signal_types.py +87 -0
  266. modelly_abm-1.0.0/modelly/experimental/signals/signals_util.py +75 -0
  267. modelly_abm-1.0.0/modelly/experimental/states/__init__.py +5 -0
  268. modelly_abm-1.0.0/modelly/experimental/states/state.py +492 -0
  269. modelly_abm-1.0.0/modelly/lint/__init__.py +82 -0
  270. modelly_abm-1.0.0/modelly/lint/__main__.py +85 -0
  271. modelly_abm-1.0.0/modelly/lint/checker.py +240 -0
  272. modelly_abm-1.0.0/modelly/lint/rules.py +182 -0
  273. modelly_abm-1.0.0/modelly/log.py +197 -0
  274. modelly_abm-1.0.0/modelly/migrate.py +264 -0
  275. modelly_abm-1.0.0/modelly/model.py +330 -0
  276. modelly_abm-1.0.0/modelly/py.typed +0 -0
  277. modelly_abm-1.0.0/modelly/reporters.py +244 -0
  278. modelly_abm-1.0.0/modelly/rng.py +205 -0
  279. modelly_abm-1.0.0/modelly/scheduling.py +155 -0
  280. modelly_abm-1.0.0/modelly/time/__init__.py +15 -0
  281. modelly_abm-1.0.0/modelly/time/events.py +600 -0
  282. modelly_abm-1.0.0/modelly/visualization/__init__.py +29 -0
  283. modelly_abm-1.0.0/modelly/visualization/backends/__init__.py +23 -0
  284. modelly_abm-1.0.0/modelly/visualization/backends/abstract_renderer.py +120 -0
  285. modelly_abm-1.0.0/modelly/visualization/backends/altair_backend.py +467 -0
  286. modelly_abm-1.0.0/modelly/visualization/backends/matplotlib_backend.py +430 -0
  287. modelly_abm-1.0.0/modelly/visualization/command_console.py +482 -0
  288. modelly_abm-1.0.0/modelly/visualization/components/__init__.py +103 -0
  289. modelly_abm-1.0.0/modelly/visualization/components/altair_components.py +529 -0
  290. modelly_abm-1.0.0/modelly/visualization/components/matplotlib_components.py +177 -0
  291. modelly_abm-1.0.0/modelly/visualization/components/portrayal_components.py +123 -0
  292. modelly_abm-1.0.0/modelly/visualization/mpl_space_drawing.py +855 -0
  293. modelly_abm-1.0.0/modelly/visualization/solara_viz.py +931 -0
  294. modelly_abm-1.0.0/modelly/visualization/space_drawers.py +852 -0
  295. modelly_abm-1.0.0/modelly/visualization/space_renderer.py +485 -0
  296. modelly_abm-1.0.0/modelly/visualization/user_param.py +69 -0
  297. modelly_abm-1.0.0/modelly/visualization/utils.py +9 -0
  298. modelly_abm-1.0.0/pelloux-baseline.json +60 -0
  299. modelly_abm-1.0.0/pelloux-guidelines.md +145 -0
  300. modelly_abm-1.0.0/pyproject.toml +192 -0
  301. modelly_abm-1.0.0/scripts/audit-pelloux.sh +5 -0
  302. modelly_abm-1.0.0/scripts/build-native.sh +18 -0
  303. modelly_abm-1.0.0/scripts/ci-local.sh +71 -0
  304. modelly_abm-1.0.0/scripts/pelloux_audit.py +238 -0
  305. modelly_abm-1.0.0/scripts/seed-pelloux-baseline.sh +5 -0
  306. modelly_abm-1.0.0/tests/__init__.py +1 -0
  307. modelly_abm-1.0.0/tests/discrete_space/test_cell_index.py +74 -0
  308. modelly_abm-1.0.0/tests/discrete_space/test_discrete_space.py +1773 -0
  309. modelly_abm-1.0.0/tests/discrete_space/test_hexgrid_torus_validation.py +35 -0
  310. modelly_abm-1.0.0/tests/discrete_space/test_occupancy.py +59 -0
  311. modelly_abm-1.0.0/tests/discrete_space/test_row_placed_agents.py +71 -0
  312. modelly_abm-1.0.0/tests/discrete_space/test_spatial_lookups.py +209 -0
  313. modelly_abm-1.0.0/tests/examples/test_alliance_formation_model.py +60 -0
  314. modelly_abm-1.0.0/tests/examples/test_end_to_end_viz.sh +8 -0
  315. modelly_abm-1.0.0/tests/examples/test_examples.py +296 -0
  316. modelly_abm-1.0.0/tests/examples/test_examples_viz.py +374 -0
  317. modelly_abm-1.0.0/tests/experimental/test_actions.py +1534 -0
  318. modelly_abm-1.0.0/tests/experimental/test_batching.py +674 -0
  319. modelly_abm-1.0.0/tests/experimental/test_continuous_space.py +665 -0
  320. modelly_abm-1.0.0/tests/experimental/test_datarecorder.py +1127 -0
  321. modelly_abm-1.0.0/tests/experimental/test_dataset.py +535 -0
  322. modelly_abm-1.0.0/tests/experimental/test_scenarios.py +1101 -0
  323. modelly_abm-1.0.0/tests/experimental/test_signals.py +1241 -0
  324. modelly_abm-1.0.0/tests/experimental/test_states.py +441 -0
  325. modelly_abm-1.0.0/tests/read_requirements.py +9 -0
  326. modelly_abm-1.0.0/tests/test_agent.py +336 -0
  327. modelly_abm-1.0.0/tests/test_agentset.py +1392 -0
  328. modelly_abm-1.0.0/tests/test_batch.py +82 -0
  329. modelly_abm-1.0.0/tests/test_cohorts.py +104 -0
  330. modelly_abm-1.0.0/tests/test_columns.py +341 -0
  331. modelly_abm-1.0.0/tests/test_datacollector.py +964 -0
  332. modelly_abm-1.0.0/tests/test_import_namespace.py +84 -0
  333. modelly_abm-1.0.0/tests/test_lifespan.py +94 -0
  334. modelly_abm-1.0.0/tests/test_lint.py +157 -0
  335. modelly_abm-1.0.0/tests/test_log.py +68 -0
  336. modelly_abm-1.0.0/tests/test_meta_agents.py +224 -0
  337. modelly_abm-1.0.0/tests/test_meta_agents_api.py +823 -0
  338. modelly_abm-1.0.0/tests/test_migrate.py +145 -0
  339. modelly_abm-1.0.0/tests/test_model.py +227 -0
  340. modelly_abm-1.0.0/tests/test_multi_level_meta_agents.py +59 -0
  341. modelly_abm-1.0.0/tests/test_rng.py +135 -0
  342. modelly_abm-1.0.0/tests/test_schedule_run.py +275 -0
  343. modelly_abm-1.0.0/tests/time/test_events.py +1201 -0
  344. modelly_abm-1.0.0/tests/visualization/test_backends.py +476 -0
  345. modelly_abm-1.0.0/tests/visualization/test_components_matplotlib.py +321 -0
  346. modelly_abm-1.0.0/tests/visualization/test_portrayal_components.py +143 -0
  347. modelly_abm-1.0.0/tests/visualization/test_solara_viz.py +528 -0
  348. modelly_abm-1.0.0/tests/visualization/test_solara_viz_scenarios.py +170 -0
  349. modelly_abm-1.0.0/tests/visualization/test_space_drawer.py +371 -0
  350. modelly_abm-1.0.0/tests/visualization/test_space_renderer.py +185 -0
  351. modelly_abm-1.0.0/tools/branding/generate_assets.py +673 -0
  352. modelly_abm-1.0.0/tools/branding/social_preview.py +61 -0
@@ -0,0 +1,137 @@
1
+ language: en-US
2
+ tone_instructions: ''
3
+ early_access: false
4
+ enable_free_tier: true
5
+ reviews:
6
+ profile: chill
7
+ request_changes_workflow: false
8
+ high_level_summary: true
9
+ high_level_summary_placeholder: '@coderabbitai summary'
10
+ high_level_summary_in_walkthrough: false
11
+ auto_title_placeholder: '@coderabbitai'
12
+ auto_title_instructions: ''
13
+ review_status: false
14
+ commit_status: true
15
+ fail_commit_status: false
16
+ collapse_walkthrough: false
17
+ changed_files_summary: true
18
+ sequence_diagrams: true
19
+ assess_linked_issues: true
20
+ related_issues: true
21
+ related_prs: true
22
+ suggested_labels: true
23
+ auto_apply_labels: false
24
+ suggested_reviewers: true
25
+ auto_assign_reviewers: false
26
+ poem: true
27
+ labeling_instructions: []
28
+ path_filters: []
29
+ path_instructions: []
30
+ abort_on_close: true
31
+ disable_cache: false
32
+ auto_review:
33
+ enabled: false
34
+ auto_incremental_review: false
35
+ ignore_title_keywords: []
36
+ labels: []
37
+ drafts: false
38
+ base_branches: []
39
+ finishing_touches:
40
+ docstrings:
41
+ enabled: true
42
+ tools:
43
+ ast-grep:
44
+ rule_dirs: []
45
+ util_dirs: []
46
+ essential_rules: true
47
+ packages: []
48
+ shellcheck:
49
+ enabled: true
50
+ ruff:
51
+ enabled: true
52
+ markdownlint:
53
+ enabled: true
54
+ github-checks:
55
+ enabled: true
56
+ timeout_ms: 180000
57
+ languagetool:
58
+ enabled: true
59
+ enabled_rules: []
60
+ disabled_rules: []
61
+ enabled_categories: []
62
+ disabled_categories: []
63
+ enabled_only: false
64
+ level: default
65
+ biome:
66
+ enabled: true
67
+ hadolint:
68
+ enabled: true
69
+ swiftlint:
70
+ enabled: true
71
+ phpstan:
72
+ enabled: true
73
+ level: default
74
+ golangci-lint:
75
+ enabled: true
76
+ yamllint:
77
+ enabled: true
78
+ gitleaks:
79
+ enabled: true
80
+ checkov:
81
+ enabled: true
82
+ detekt:
83
+ enabled: true
84
+ eslint:
85
+ enabled: true
86
+ rubocop:
87
+ enabled: true
88
+ buf:
89
+ enabled: true
90
+ regal:
91
+ enabled: true
92
+ actionlint:
93
+ enabled: true
94
+ pmd:
95
+ enabled: true
96
+ cppcheck:
97
+ enabled: true
98
+ semgrep:
99
+ enabled: true
100
+ circleci:
101
+ enabled: true
102
+ sqlfluff:
103
+ enabled: true
104
+ prismaLint:
105
+ enabled: true
106
+ oxc:
107
+ enabled: true
108
+ shopifyThemeCheck:
109
+ enabled: true
110
+ chat:
111
+ auto_reply: true
112
+ create_issues: true
113
+ integrations:
114
+ jira:
115
+ usage: auto
116
+ linear:
117
+ usage: auto
118
+ knowledge_base:
119
+ opt_out: false
120
+ web_search:
121
+ enabled: true
122
+ learnings:
123
+ scope: auto
124
+ issues:
125
+ scope: auto
126
+ jira:
127
+ usage: auto
128
+ project_keys: []
129
+ linear:
130
+ usage: auto
131
+ team_keys: []
132
+ pull_requests:
133
+ scope: auto
134
+ code_generation:
135
+ docstrings:
136
+ language: en-US
137
+ path_instructions: []
@@ -0,0 +1,23 @@
1
+ # Normalise line endings so a checkout on Windows never dirties the tree.
2
+ * text=auto eol=lf
3
+ *.bat text eol=crlf
4
+ *.png binary
5
+ *.ico binary
6
+
7
+ # Notebooks are text; keep tutorial notebooks output-free so their diffs stay reviewable.
8
+ *.ipynb text
9
+
10
+ # Generated files: collapsed in pull-request diffs and excluded from language statistics.
11
+ docs/images/branding/*.svg linguist-generated
12
+ docs/examples/** linguist-generated
13
+ pelloux-baseline.json linguist-generated
14
+
15
+ # Documentation and examples should not skew the repository's language breakdown.
16
+ docs/** linguist-documentation
17
+ benchmarks/** linguist-vendored=false
18
+
19
+ # Keep local-only material out of release archives (git archive, GitHub source zips).
20
+ benchmarks/mesa_baseline/ export-ignore
21
+ benchmarks/mesaVSmodelly/ export-ignore
22
+ .github/ export-ignore
23
+ .pre-commit-config.yaml export-ignore
@@ -0,0 +1,11 @@
1
+ # Review requests are routed to these owners automatically.
2
+ # The last matching pattern wins.
3
+
4
+ * @RemiPelloux
5
+
6
+ /modelly/ @RemiPelloux
7
+ /docs/ @RemiPelloux
8
+ /.github/ @RemiPelloux
9
+ /pyproject.toml @RemiPelloux
10
+ /pelloux-guidelines.md @RemiPelloux
11
+ /pelloux-baseline.json @RemiPelloux
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: Bug report
3
+ about: Let us know if something is broken on Modelly
4
+
5
+ ---
6
+
7
+ **Describe the bug**
8
+ <!-- A clear and concise description the bug -->
9
+
10
+ **Expected behavior**
11
+ <!-- A clear and concise description of what you expected to happen -->
12
+
13
+ **To Reproduce**
14
+ <!-- Steps to reproduce the bug, or a link to a project where the bug is visible
15
+ Include a Minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example -->
16
+
17
+ **Additional context**
18
+ <!--
19
+ Add any other context here.
20
+ Any details about your specific platform:
21
+ * If the problem is in the browser, what browser, version, and OS?
22
+ -->
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Questions, ideas, showcases and more
4
+ url: https://github.com/RemiPelloux/Modelly/discussions
5
+ about: Discuss Modelly, ask questions, share ideas, and showcase your projects
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest a new feature for Modelly
4
+
5
+ ---
6
+
7
+ **What's the problem this feature will solve?**
8
+ <!-- A clear and concise description of what the problem is. -->
9
+
10
+ **Describe the solution you'd like**
11
+ <!-- A clear and concise description of what you want to happen. -->
12
+
13
+ **Are you planning to open a PR for this?**
14
+ <!-- For enhancements/new features, please wait for maintainer approval on this issue/discussion before opening a PR. -->
15
+
16
+ **Additional context**
17
+ <!-- Add any other context, links, etc. about the feature here. -->
@@ -0,0 +1,23 @@
1
+ > [!NOTE]
2
+ > Use this template for bug fixes only. For enhancements/new features, use the feature template and get maintainer approval in an issue/discussion before opening a PR.
3
+
4
+ ### Pre-PR Checklist
5
+ - [ ] This PR is a bug fix, not a new feature or enhancement.
6
+
7
+ ### Summary
8
+ <!-- Provide a brief summary of the bug and its impact. -->
9
+
10
+ ### Bug / Issue
11
+ <!-- Link to the related issue(s) and describe the bug. Include details like the context, what was expected, and what actually happened. -->
12
+
13
+ ### Implementation
14
+ <!-- Describe the changes made to resolve the issue. Highlight any important parts of the code that were modified. -->
15
+
16
+ ### Testing
17
+ <!-- Detail the testing performed to verify the fix. Include information on test cases, steps taken, and any relevant results.
18
+
19
+ If you're fixing the visualisation, add before/after screenshots. -->
20
+
21
+ ### Additional Notes
22
+ <!-- Add any additional information that may be relevant for the reviewers, such as potential side effects, dependencies, or related work.
23
+ -->
@@ -0,0 +1,25 @@
1
+ > [!IMPORTANT]
2
+ > For enhancements and new features, include the issue/discussion where a maintainer approved this work before opening a PR. Unapproved feature/enhancement PRs may be closed.
3
+
4
+ ### Pre-PR Checklist
5
+ - [ ] I linked an issue/discussion where a maintainer approved this enhancement/feature for implementation.
6
+
7
+ ### Approval Link
8
+ <!-- Link to the issue/discussion comment where a maintainer confirmed this is ready for a PR. -->
9
+
10
+ ### Summary
11
+ <!-- Provide a concise summary of the feature and its purpose. -->
12
+
13
+ ### Motive
14
+ <!-- Explain the reasoning behind this feature. Include details on the problem it addresses or the enhancement it provides. -->
15
+
16
+ ### Implementation
17
+ <!-- Describe how the feature was implemented. Include details on the approach taken, important decisions made, and code changes. -->
18
+
19
+ ### Usage Examples
20
+ <!-- Provide code snippets or examples demonstrating how to use the new feature. Highlight key scenarios where this feature will be beneficial.
21
+
22
+ If you're modifying the visualisation, add before/after screenshots. -->
23
+
24
+ ### Additional Notes
25
+ <!-- Add any additional information that may be relevant for the reviewers, such as potential side effects, dependencies, or related work. -->
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain dependencies for GitHub Actions
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ # Check for updates to GitHub Actions every week
8
+ interval: "weekly"
@@ -0,0 +1,6 @@
1
+ Thanks for opening a PR! Please click the `Preview` tab and select a PR template:
2
+
3
+ - [🐛 Bug fix](?expand=1&template=bug.md)
4
+ - [🛠 Feature/enhancement](?expand=1&template=feature.md)
5
+
6
+ Feature/enhancement PRs require prior maintainer approval in an issue or discussion before they are accepted.
@@ -0,0 +1,43 @@
1
+ # Docs: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
2
+ changelog:
3
+ exclude:
4
+ labels:
5
+ - ignore-for-release
6
+ categories:
7
+ - title: ⚠️ Breaking changes
8
+ labels:
9
+ - breaking
10
+ - title: ⏳ Deprecations
11
+ labels:
12
+ - deprecation
13
+ - title: 🧪 Experimental
14
+ labels:
15
+ - experimental
16
+ - title: 🎉 New features added
17
+ labels:
18
+ - feature
19
+ - title: 🛠 Enhancements made
20
+ labels:
21
+ - enhancement
22
+ - title: 🐛 Bugs fixed
23
+ labels:
24
+ - bug
25
+ - title: ⚡ Performance improvements
26
+ labels:
27
+ - performance
28
+ - title: 🔍 Examples updated
29
+ labels:
30
+ - example
31
+ - title: 📜 Documentation improvements
32
+ labels:
33
+ - docs
34
+ - title: 🔧 Maintenance
35
+ labels:
36
+ - ci
37
+ - testing
38
+ - dependency
39
+ - maintenance
40
+ - packaging
41
+ - title: Other changes
42
+ labels:
43
+ - "*"
@@ -0,0 +1,75 @@
1
+ # Vale Configuration for Modelly
2
+
3
+ Vale is a syntax-aware prose linter that helps maintain consistent, high-quality documentation across Modelly's markdown and reStructuredText files.
4
+
5
+ ## How Vale is Configured for Modelly
6
+
7
+ ### Base Style: Google Developer Style Guide
8
+
9
+ Modelly uses the Google style guide as its foundation because it prioritizes technical clarity and developer documentation over corporate/marketing tone. This aligns well with Modelly's technical, academic audience.
10
+
11
+ ### Configuration Files
12
+
13
+ - **`.vale.ini`**: Main configuration at repository root
14
+ - **`.github/styles/Modelly/modelly.yml`**: Custom Modelly-specific terminology rules (e.g., "Modelly" vs "modelly", "NumPy" vs "numpy")
15
+ - **`.github/workflows/vale.yml`**: CI workflow that runs on documentation changes
16
+
17
+ ### Alert Levels
18
+
19
+ Modelly uses a tiered approach:
20
+
21
+ - **`suggestion`** (default): Google style recommendations are informational only, non-blocking
22
+ - **`warning`**: Important issues shown in CI (via `--minAlertLevel=warning`)
23
+ - **`error`**: Modelly branding rules that must be enforced (e.g., correct capitalization)
24
+
25
+ ### Disabled Google Rules
26
+
27
+ Many Google rules are disabled for technical documentation:
28
+
29
+ - **Acronyms, Passive Voice, Semicolons**: Common and acceptable in technical writing
30
+ - **First Person, Contractions**: "We" and formal tone are appropriate for tutorials
31
+ - **Headings, Spacing**: Can have false positives with code examples and formulas
32
+ - **Spelling**: Modelly already uses `codespell` to avoid redundancy
33
+
34
+ See [`.vale.ini`](../../.vale.ini) for the complete list and rationale.
35
+
36
+ ### Excluded Files
37
+
38
+
39
+ ## CI Integration
40
+
41
+ Vale runs automatically on:
42
+ - Pull requests modifying `*.md`, `*.rst`, `*.txt`, or `docs/**`
43
+ - Pushes to `main` branch
44
+ - Manual workflow dispatch from Actions tab
45
+
46
+ The workflow checks documentation with `--minAlertLevel=warning`, meaning only warnings and errors are reported (suggestions are hidden in CI).
47
+
48
+ ## Understanding Vale Output
49
+
50
+ ### Alert Levels
51
+
52
+ - 🔵 **suggestion**: Style recommendations (informational, hidden in CI)
53
+ - 🟡 **warning**: Important style issues
54
+ - 🔴 **error**: Critical issues (e.g., incorrect branding)
55
+
56
+ ### Example Output
57
+
58
+ ```
59
+ docs/tutorials/intro.md
60
+ 15:23 warning Use 'for example' instead of 'e.g.'. Google.Latin
61
+ 28:1 error 'modelly' should be 'Modelly'. Modelly.Branding
62
+ ```
63
+
64
+ **Reading:**
65
+ - `15:23` = Line 15, Column 23
66
+ - `warning`/`error` = Alert level
67
+ - Middle column = Fix suggestion
68
+ - Right column = Rule that triggered
69
+
70
+ ## Resources
71
+
72
+ - **Vale Documentation**: https://vale.sh/docs/
73
+ - **Google Style Guide**: https://developers.google.com/style
74
+ - **Installation**: See Vale's [installation guide](https://vale.sh/docs/vale-cli/installation/)
75
+ - **Running locally**: `vale sync` (first time), then `vale *.md docs/`
@@ -0,0 +1,14 @@
1
+ # styles/Modelly/Branding.yml
2
+ extends: substitution
3
+ message: "Use '%s' instead of '%s'."
4
+ level: error
5
+ ignorecase: true
6
+ swap:
7
+ # modelly: Modelly
8
+ # MODELLY: MODELLY
9
+ # numpy: NumPy
10
+ # matplotlib: Matplotlib
11
+ # pytorch: PyTorch
12
+ # scikit-learn: scikit-learn
13
+ # dataframe: DataFrame
14
+ # python: Python
@@ -0,0 +1,37 @@
1
+ name: Comment benchmark results
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Performance benchmarks"]
6
+ types:
7
+ - completed
8
+
9
+ permissions:
10
+ issues: write
11
+ pull-requests: write
12
+
13
+ jobs:
14
+ comment:
15
+ if: github.event.workflow_run.conclusion == 'success'
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Download benchmark results
19
+ uses: actions/download-artifact@v8
20
+ with:
21
+ name: benchmark-results
22
+ run-id: ${{ github.event.workflow_run.id }}
23
+ github-token: ${{ secrets.GITHUB_TOKEN }}
24
+
25
+ - name: Comment PR
26
+ uses: actions/github-script@v9
27
+ with:
28
+ script: |
29
+ const fs = require('fs');
30
+ const prNumber = parseInt(fs.readFileSync('pr_number.txt', 'utf8').trim());
31
+ const output = fs.readFileSync('benchmark_output.txt', 'utf8');
32
+ await github.rest.issues.createComment({
33
+ issue_number: prNumber,
34
+ owner: context.repo.owner,
35
+ repo: context.repo.repo,
36
+ body: 'Performance benchmarks:\n\n' + output
37
+ });
@@ -0,0 +1,85 @@
1
+ name: Performance benchmarks
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, ready_for_review, labeled]
6
+ branches:
7
+ - main
8
+ paths:
9
+ - '**.py'
10
+ - '.github/workflows/benchmarks.yml'
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ run-benchmarks:
17
+ if: >
18
+ github.event.action == 'labeled' && contains(github.event.pull_request.labels.*.name, 'trigger-benchmarks') ||
19
+ github.event.action == 'opened' ||
20
+ github.event.action == 'ready_for_review'
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Set up Python
24
+ uses: actions/setup-python@v7
25
+ with:
26
+ python-version: '3.14'
27
+ - name: Add project directory to PYTHONPATH
28
+ run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV
29
+ - name: Install uv
30
+ run: pip install uv
31
+ - name: Install dependencies
32
+ run: uv pip install --system numpy pandas tqdm tabulate matplotlib solara networkx scipy
33
+
34
+ # Benchmarks on main
35
+ - name: Checkout main branch
36
+ uses: actions/checkout@v7
37
+ with:
38
+ ref: main
39
+ repository: RemiPelloux/Modelly
40
+ - name: Install Modelly
41
+ run: pip install --no-deps .
42
+ - name: Run benchmarks on main branch
43
+ working-directory: benchmarks
44
+ run: python global_benchmark.py
45
+
46
+ # Upload main benchmarks, then checkout PR
47
+ - name: Upload benchmark results
48
+ uses: actions/upload-artifact@v7
49
+ with:
50
+ name: timings-main
51
+ path: benchmarks/timings_1.pickle
52
+ - name: Checkout PR branch
53
+ uses: actions/checkout@v7
54
+ with:
55
+ ref: ${{ github.event.pull_request.head.ref }}
56
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
57
+ fetch-depth: 0
58
+ persist-credentials: false
59
+ clean: false
60
+ - name: Install Modelly of the PR branch
61
+ run: pip install --no-deps .
62
+ - name: Download benchmark results
63
+ uses: actions/download-artifact@v8
64
+ with:
65
+ name: timings-main
66
+ path: benchmarks
67
+
68
+ # Run benchmarks on PR and compare
69
+ - name: Run benchmarks on PR branch
70
+ working-directory: benchmarks
71
+ run: python global_benchmark.py
72
+ - name: Run compare timings
73
+ working-directory: benchmarks
74
+ run: python compare_timings.py > benchmark_output.txt
75
+
76
+ # Save PR number and results for the comment workflow
77
+ - name: Save PR number
78
+ run: echo "${{ github.event.pull_request.number }}" > benchmarks/pr_number.txt
79
+ - name: Upload benchmark comparison
80
+ uses: actions/upload-artifact@v7
81
+ with:
82
+ name: benchmark-results
83
+ path: |
84
+ benchmarks/benchmark_output.txt
85
+ benchmarks/pr_number.txt
@@ -0,0 +1,101 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - release**
8
+ paths-ignore:
9
+ - "**.md"
10
+ pull_request:
11
+ paths-ignore:
12
+ - "**.md"
13
+ workflow_dispatch:
14
+ schedule:
15
+ - cron: "0 6 * * 1"
16
+
17
+ # This will cancel previous run if a newer job that obsoletes the said previous
18
+ # run, is started.
19
+ # Based on https://github.com/zulip/zulip/commit/4a11642cee3c8aec976d305d51a86e60e5d70522
20
+ concurrency:
21
+ group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}"
22
+ cancel-in-progress: true
23
+
24
+ jobs:
25
+ build:
26
+ runs-on: ${{ matrix.os }}-latest
27
+ strategy:
28
+ fail-fast: False
29
+ matrix:
30
+ os: [windows, ubuntu, macos]
31
+ python-version: ["3.14"]
32
+ pip-pre: [""]
33
+ include:
34
+ - os: ubuntu
35
+ python-version: "3.13"
36
+ - os: ubuntu
37
+ python-version: "3.12"
38
+ - os: ubuntu
39
+ python-version: "3.14"
40
+ pip-pre: "--pre"
41
+ # Disabled for now. See https://github.com/RemiPelloux/Modelly/issues/1253
42
+ #- os: ubuntu
43
+ # python-version: 'pypy-3.8'
44
+
45
+ steps:
46
+ - uses: actions/checkout@v7
47
+ - name: Set up Python ${{ matrix.python-version }}
48
+ uses: actions/setup-python@v7
49
+ with:
50
+ python-version: ${{ matrix.python-version }}
51
+ allow-prereleases: true
52
+ cache: "pip"
53
+ - name: Install uv
54
+ run: pip install uv
55
+ - name: Install Modelly and dependencies
56
+ run: uv pip install --system .[dev] ${{ matrix.pip-pre }}
57
+ - name: Setup Playwright
58
+ run: playwright install chromium-headless-shell
59
+ - name: Test with pytest
60
+ run: pytest --durations=10 tests/ -Werror -Wdefault::PendingDeprecationWarning
61
+
62
+ coverage:
63
+ runs-on: ubuntu-latest
64
+ timeout-minutes: 6
65
+ steps:
66
+ - uses: actions/checkout@v7
67
+ - uses: actions/setup-python@v7
68
+ with:
69
+ python-version: "3.14"
70
+ - run: pip install uv
71
+ - run: uv pip install --system .[dev]
72
+ - run: playwright install chromium-headless-shell
73
+ - run: python -Im pytest -p pytest_cov --cov --cov-report=xml --cov-report=markdown-append:"${GITHUB_STEP_SUMMARY}" --cov-context=test tests/
74
+ - uses: codecov/codecov-action@v7
75
+ with:
76
+ fail_ci_if_error: true
77
+ token: ${{ secrets.CODECOV_TOKEN }}
78
+
79
+ examples:
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v7
83
+ - name: Set up Python
84
+ uses: actions/setup-python@v7
85
+ with:
86
+ python-version: "3.13"
87
+ allow-prereleases: true
88
+ cache: "pip"
89
+ - name: Install uv
90
+ run: pip install uv
91
+ - name: Install Modelly
92
+ run: uv pip install --system .[examples]
93
+ - name: Checkout modelly-examples
94
+ uses: actions/checkout@v7
95
+ with:
96
+ repository: RemiPelloux/Modelly-examples
97
+ path: modelly-examples
98
+ - name: Test examples
99
+ run: |
100
+ cd modelly-examples
101
+ pytest -rA -Werror -Wdefault::PendingDeprecationWarning test_examples.py