Skip to content

Releases: projectmesa/mesa

v2.3.0

23 Apr 19:35
ed2cadf
Compare
Choose a tag to compare

Highlights

Mesa 2.3.0 is a big feature release and the last feature release before 3.0.

There are two main new features:

  • 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 but extend and generalize this concept further.
  • Full support for discrete event scheduling, as added in #2066. It allows scheduling events (like Agent actions) at any time, including non-integer timesteps.

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.

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.

Install this release with:

pip install --upgrade mesa

The Mesa 2.3.x-series supports Python 3.9 to 3.12. The next major release will require Python 3.10.

What's Changed

🧪 Experimental features

  • Add cell-centric discrete spaces (experimental) by @Corvince in #1994

🎉 New features added

🛠 Enhancements made

  • JupyterViz: Automatically deduce display name from model class by @rht in #1975
  • Add radius argument to NetworkGrid.get_neighbors() by @EwoutH in #1973
  • Speedup of Agentset.shuffle by @quaquel in #2010
  • feat: Let mesa runserver detect server.py as fallback by @rht in #2015
  • JupyterViz: {Convert make_plot & prepare ColorCard} to become Solara component by @rht in #2020
  • new feature: AgentSet.get can retrieve one or more then one attribute by @quaquel in #2044
  • Update CODE_OF_CONDUCT.md to version 2+ of contrib covenant by @jackiekazil in #2052
  • Improve flocking benchmark by @coderbeta1 in #2054
  • Remove JupyterViz Altair marker overlap for huge grid size by @rht in #2062
  • Add tooltip option to Altair chart by @FoFFolo in #2082
  • feat: Display model seed & allow user to specify it in JupyterViz by @rht in #2069
  • warn if placing already placed agent by @puer-robustus in #2083

🐛 Bugs fixed

  • fix: Apply default value to slider by @rht in #2016
  • fix: Initialize model _steps and _time during new by @rht in #2026
  • fix: Use model.schedule only when it is not None by @rht in #2050
  • fix: Remove JupyterViz grid marker overlap for huge grid size by @rht in #2049
  • Make agent move to actual random closest position by @EwoutH in #2119

📜 Documentation improvements

  • Improve readability of badges by @rht in #2009
  • More pythonic implementation of wolf sheep by @quaquel in #2011
  • Adding super().init() to MoneyModel tutorial by @sw23 in #2025
  • docs: Convert howto.rst -> howto.md via rst2myst by @rht in #2033
  • docs: Convert best-practices,overview,packages,mesa,index to .md via rst2myst by @rht in #2034
  • docs: Convert api/.rst -> api/.md via rst2myst by @rht in #2035
  • docs: Rewrite howto.md using ChatGPT for clarity and conciseness by @rht in #2037
  • docs: Corrected Contributing Guide Link to Ensure Accessibility by @sahusiddharth in #2057
  • Rename links to internal .rst files to .md by @rht in #2058
  • docs: improve introductory tutorial by @puer-robustus in #2087

🔧 Maintenance

  • Quality of Life: Make codecov less meticulous by @Corvince in #1966
  • Add CI workflow for performance benchmarks by @EwoutH in #1983
  • tests: Resolve warnings by defining PropertyLayer dtypes by @EwoutH in #1987
  • benchmarks.yml: Fix PR branch checkout when triggered by comment by @EwoutH in #1998
  • Quality of life: automatically fix ruff errors by @Corvince in #2004
  • benchmarks.yml: Run on addition of label instead of comment by @EwoutH in #2002
  • ci: Move codespell to pre-commit by @rht in #2040
  • Schelling by @coderbeta1 in #2053
  • Move ruff lint settings into dedicated section by @Corvince in #2073
  • ci: Use uv pip for faster build by @rht in #2038
  • test: Remove place_agent duplicate warnings by @rht in #2086

Other changes

New Contributors

Full Changelog: v2.2.4...2.3.0

v2.3.0-rc1

19 Apr 08:56
Compare
Choose a tag to compare
v2.3.0-rc1 Pre-release
Pre-release

Highlights

The 2.3.0-rc1 release is our first release candidate pre-release, meant to test all the new features and enhancement for the upcoming 2.3.0 release.

There are two main new features:

  • 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 but extend and generalize this concept further.
  • Full support for discrete event scheduling, as added in #2066. It allows scheduling events (like Agent actions) at any time, including non-integer timesteps.

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.

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.

Install this pre-release with:

pip install --pre mesa

We would love feedback before we release 2.3.0 stable in ~1 week.

What's Changed

🧪 Experimental features

  • Add cell-centric discrete spaces (experimental) by @Corvince in #1994

🎉 New features added

🛠 Enhancements made

  • JupyterViz: Automatically deduce display name from model class by @rht in #1975
  • Add radius argument to NetworkGrid.get_neighbors() by @EwoutH in #1973
  • Speedup of Agentset.shuffle by @quaquel in #2010
  • feat: Let mesa runserver detect server.py as fallback by @rht in #2015
  • JupyterViz: {Convert make_plot & prepare ColorCard} to become Solara component by @rht in #2020
  • new feature: AgentSet.get can retrieve one or more then one attribute by @quaquel in #2044
  • Update CODE_OF_CONDUCT.md to version 2+ of contrib convenant by @jackiekazil in #2052
  • Improve flocking benchmark by @coderbeta1 in #2054
  • Remove JupyterViz Altair marker overlap for huge grid size by @rht in #2062
  • Add tooltip option to Altair chart by @FoFFolo in #2082
  • feat: Display model seed & allow user to specify it in JupyterViz by @rht in #2069
  • warn if placing already placed agent by @puer-robustus in #2083

🐛 Bugs fixed

  • fix: Apply default value to slider by @rht in #2016
  • fix: Initialize model _steps and _time during new by @rht in #2026
  • fix: Use model.schedule only when it is not None by @rht in #2050
  • fix: Remove JupyterViz grid marker overlap for huge grid size by @rht in #2049

📜 Documentation improvements

  • Improve readability of badges by @rht in #2009
  • More pythonic implementation of wolf sheep by @quaquel in #2011
  • Adding super().init() to MoneyModel tutorial by @sw23 in #2025
  • docs: Convert howto.rst -> howto.md via rst2myst by @rht in #2033
  • docs: Convert best-practices,overview,packages,mesa,index to .md via rst2myst by @rht in #2034
  • docs: Convert api/.rst -> api/.md via rst2myst by @rht in #2035
  • docs: Rewrite howto.md using ChatGPT for clarity and conciseness by @rht in #2037
  • docs: Corrected Contributing Guide Link to Ensure Accessibility by @sahusiddharth in #2057
  • Rename links to internal .rst files to .md by @rht in #2058
  • docs: improve introductory tutorial by @puer-robustus in #2087

🔧 Maintenance

  • Quality of Life: Make codecov less meticulous by @Corvince in #1966
  • Add CI workflow for performance benchmarks by @EwoutH in #1983
  • tests: Resolve warnings by defining PropertyLayer dtypes by @EwoutH in #1987
  • benchmarks.yml: Fix PR branch checkout when triggered by comment by @EwoutH in #1998
  • Quality of life: automatically fix ruff errors by @Corvince in #2004
  • benchmarks.yml: Run on addition of label instead of comment by @EwoutH in #2002
  • ci: Move codespell to pre-commit by @rht in #2040
  • Schelling by @coderbeta1 in #2053
  • Move ruff lint settings into dedicated section by @Corvince in #2073
  • ci: Use uv pip for faster build by @rht in #2038
  • test: Remove place_agent duplicate warnings by @rht in #2086

Other changes

New Contributors

Full Changelog: v2.2.4...2.3.0-rc1

v2.2.4

26 Jan 21:46
8251e97
Compare
Choose a tag to compare

Highlights

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). It also fixes a small behaviour change in RandomActivationByType.agents_by_type() (#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).

Updating from previous 2.2 releases is highly recommended, especially when using the RandomActivation scheduler.

What's Changed

🛠 Enhancements made

  • refactor: Remove dependence on model.schedule, add clock to Model by @rht in #1942

🐛 Bugs fixed

  • Fix AgentSet inplace shuffle (and thus RandomActivation), add tests by @EwoutH and @quaquel in #2007
  • fix: Reverse dict key and value for agents_by_type by @rht in #1996

Full Changelog: v2.2.3...v2.2.4

v2.2.3

22 Jan 21:42
400cd88
Compare
Choose a tag to compare

Highlights

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.

What's Changed

🧪 Experimental features

  • solara_viz: Add borders around ContinuousSpace by @EwoutH in #1988

🐛 Bugs fixed

  • fix: Explicitly specify JupyterViz space view limits by @rht in #1984

Full Changelog: v2.2.2...v2.2.3

v2.2.2

22 Jan 08:13
ed9e88e
Compare
Choose a tag to compare

Highlights

Mesa 2.2.2 is a small bugfix release, for models in which users had defined Model.agents (self.agents in a Model (sub)class). This is deprecated, but for now allowed. See #1919 (comment).

What's Changed

🐛 Bugs fixed

  • Allow user models to assign Model.agents for now, but add warning by @quaquel in #1976

Full Changelog: v2.2.1...v2.2.2

v2.2.1

16 Jan 12:10
Compare
Choose a tag to compare

Highlights

After the substantive 2.2.0 release we are releasing 2.2.1 which addresses a few bugs, unintended behaviors and a performance regression. #1960 makes sure agent addition and removal is handled correct, #1965 fixed an unintended behavior change in RandomActivationByType.agents_by_type and #1964 makes sure we're at least as fast as before 2.2.0, if not faster. The introduction tutorial is also extended with #1955.

We highly recommend updating to 2.2.1 if you're using 2.2.0.

pip install --upgrade mesa

What's Changed

🧪 Experimental features

  • jupyter_viz: Implement multiline plot by @rht in #1941

🛠 Enhancements made

  • make mesa runable without some dependencies by @Corvince in #1950
  • Improve performance of AgentSet and iter_cell_list_contents by @Corvince in #1964

🐛 Bugs fixed

  • Bugfix in agentset to handle addition and removal correctly by @quaquel in #1960
  • Make RandomActivationByType.agents_by_type backward compatible by @quaquel in #1965

📜 Documentation improvements

  • Refer to just Python instead of Python 3 by @rht in #1957
  • intro tutorial: Analysing model reporters by @EwoutH in #1955

🔧 Maintenance

  • Migrate from setuptools to hatch by @rht in #1882
  • ci: Add tests for mesa-examples by @rht in #1956
  • refactor: Move Matplotlib-specific Solara components to separate file by @rht in #1943

Full Changelog: v2.2.0...v2.2.1

v2.2.0

09 Jan 10:32
Compare
Choose a tag to compare

Highlights

The 2.2.0 release of the Mesa library introduces several updates and new features for managing and scheduling agents and modelling the environment, along with an experimental release policy aimed at enhancing development speed and community feedback. Below are key highlights of the new (experimental) features in this release. Mesa 2.2.0 supports Python 3.9+.

Despite the minor version number, this is one of our biggest releases yet.

Experimental feature policy (discussion #1909)

This release introduces an experimental feature policy aimed at accelerating development and gathering community feedback. Features like #1890, #1898, and #1916 are marked as experimental under this policy.

Policy overview:

  • Experimental features can be added or changed in any release, even patch releases.
  • They don’t need a diligent review for every change, allowing for quicker development cycles.
  • Community feedback is encouraged through discussion threads.

Native support for multiple Agent types (PR #1894)

This update introduces a agents variable to the Mesa Model class, offering a first step in supporting multiple agent types as first class citizens. Each Model is now initialized with an self.agents variable (an AgentSet) in which all the agents are tracked. You can now always ask which agents are in the model with model.agents. It's the foundation which will allow us to solve problems with scheduling, data collection and visualisation of multiple agent types in the future.

🧪 AgentSet class (PR #1916)

The new AgentSet class encapsulates and manages collections of agents, streamlining the process of selecting, sorting, and applying actions to groups of agents.

Key features:

  • Flexible and efficient agent management and manipulation.
  • Methods like select, shuffle, sort, and do for intuitive operations.

Example:

# Applying a method to each agent
model.agents.do('step')

# Filtering and shuffling agents
shuffled_agents = model.agents.select(lambda agent: agent.attribute > threshold).shuffle()

The AgentSet is an experimental feature. We would love feedback on it in #1919.

🧪 PropertyLayer and _PropertyGrid (PR #1898)

The introduction of PropertyLayer and the extension of SingleGrid and MultiGrid classes to support cell properties mark a significant enhancement in Mesa's environmental modeling capabilities. It allows to add different layers of variables to grids, that can be used to represent spatial environmental properties, such as elevation, pollution, flood levels or foliage.

Key features:

  • Efficient management of environmental properties like terrain types and resources.
  • Dynamic interaction between agents and their environment.
  • Fast modification and selection of cells based on one or multiple properties

Example:

from mesa.space import SingleGrid, PropertyLayer

grid = SingleGrid(10, 10, False)
property_layer = PropertyLayer("elevation", 10, 10, default_value=0)
grid.add_property_layer(property_layer)

# Modify multiple cells values
grid.properties["elevation"].modify_cells(np.multiply, 2)

# Select cells that have an elevation of at least 50
high_elevation_cells = grid.properties["elevation"].select_cells(condition=lambda x: x > 50)

The PropertyLayer is an experimental feature. We would love feedback on it in #1932.

🧪 DiscreteEventScheduler (PR #1890)

The DiscreteEventScheduler is an innovative addition to the Mesa time module, tailored for discrete event simulations. This scheduler advances simulations based on specific event timings rather than regular intervals, providing more flexibility in modeling complex systems.

Key Features:

  • Efficient handling of events scheduled for specific simulation times.
  • Randomized execution order for events scheduled at the same time.

The DiscreteEventScheduler is an experimental feature. We would love feedback on it in #1923.

What's Changed

🧪 Experimental features

🎉 New features added

🛠 Enhancements made

  • Reimplement schedulers to use AgentSet by @quaquel in #1926
  • space: Let move_agent choose from multiple positions by @EwoutH in #1920

🐛 Bugs fixed

  • Work around for initializing model._agent by @quaquel in #1928
  • Honor disabled space drawer option when rendering in the browser by @rlskoeser in #1907

📜 Documentation improvements

  • Document empties property by @EwoutH in #1888
  • docs: Fix README.md inline code formatting by @rht in #1887

🔧 Maintenance

  • ci: Speed up pip install by caching deps install output by @rht in #1885
  • Create release.yml file for automatic release notes generation by @EwoutH in #1925
  • Drop support for Python 3.8 by @rht in #1756

New Contributors

Full Changelog: v2.1.5...v2.2.0

v2.1.5

07 Nov 12:31
Compare
Choose a tag to compare

2.1.5 (2023-11-26)

This release has some critical fixes to JupyterViz/Solara frontend to prevent
flickering and improve the display of the jupyter plots. It also has
improvements to datacollection and the documentation.

Improvements

  • datacollection: check if model reporters is a partial function (#1872)

Docs and Tutorial

  • docs: convert README from .rst to .md (#1881)
  • docs: convert HISTORY from .rst to .md (#1873)
  • docs: enhance docstrings for scheduler classes in mesa.time (#1866)

CI and WorkFlows

  • ci: Remove redundant Ruff workflow from GitHub Actions (#1880)
  • Replace Black with ruff format (#1880)
  • Migrate setup from setup.py to pyproject.toml (#1870)

Solara/JupyterViz

  • fix: Do render_in_jupyter on Colab env (#1884)
  • Convert make_space into Solara component (#1877)
  • remove controls for dragging and resizing (#1878)
  • Improve ColorCard layout (#1876)
  • refactor: Define current_step as reactive (#1875)
  • fix: optimize controller and plots to fill screen in jupyter (#1868)
  • fix: ensure space and plot subcomponent are not rendered on step (#1867)

2.1.4 (2023-11-7)


This release updates mesa-viz-tornado dependency v0.1.3. This removes the
external JavaScript templates and prevents 404 errors

  • bugfix: ensure mesa_viz_tornado>=0.1.3 #1862

2.1.3 (2023-11-5)


This release contains several improvements, fixes, and new features to
the JupyterViz/Solara frontend. It's a patch release instead of a minor release
because the JupyterViz frontend is still considered experimental.

Improvements

  • model: ensure model is initialized with random seed based #1814
  • space: check if position values are tuples #1831
  • datacollection: add agent collection by type, documentation, and tests #1838

Docs and Tutorial

  • tutorial: explain how to set up reporter for multiple agents #1717
  • docs: rename useful snippets to how to guide #1839

CI and WorkFlows

  • Release CI: update to run workflows on releases #1479
  • CI: Update GHA workflows with Python 3.12 #1840
  • update ruff version #1824, #1841
  • Ensure mesa_viz_tornado>=0.1.2 #1860

Solara/JupyterViz

  • perf: increase speed of Solara render #1819
  • implement drawer for continuous space and refactor code #1830
  • fix: configure change handler for checkbox input #1844
  • fix: ensure playing starts after model param change #1851

v2.1.2

24 Sep 00:11
@rht rht
Compare
Choose a tag to compare

This release contains fixes, and several improvements and new features to
the JupyterViz/Solara frontend. It's a patch release instead of a minor release
because the JupyterViz frontend is still considered experimental.

Improvements

  • perf: Access grid only once #1751
  • docs: compile notebooks at build time #1753
  • docs: Remove nbsphinx and explicit .ipynb suffix #1754
  • rtd: Use gruvbox-dark as style #1719
  • build(deps): bump actions/checkout from 3 to 4 #1790

Solara/JupyterViz

  • solara: Implement visualization for network grid #1767
  • Add support for select input type #1779
  • Add step count display to JupyterViz #1775
  • Simplify solara code #1786
  • Add docstring for jupyterviz make_user_input that documents supported inputs #1784
  • Revise, test, & document JupyterViz options for drawing agent space #1783
  • Add UserInputs component #1788
  • Fix: Remove dict merge operator, python 3.8 compat #1793
  • feat: Add reset button to JupyterViz #1795
  • Add support for solara.Checkbox user input #1798
  • viz tutorial: Update custom plot to reflect new code #1799
  • fix: Don't continue playing when a model is reset #1796
  • Docker: Update to use Solara viz #1757

Refactors

  • Move viz stuff to mesa-viz-tornado Git repo #1746
  • simplify get neighborhood #1760
  • remove attrgetter performance optimization #1809

Fixes

  • fix: Add Matplotlib as dependency #1747
  • fix install for visualization tutorial in colab #1752
  • fix: Allow multiple connections in Solara #1759
  • Revert "Ensure sphinx>=7" #1762
  • fix README pic to remove line on left side #1763
  • space: Ensure get_neighborhood output & cache are immutable #1780
  • fix: Use .pytemplate for name for cookiecutter #1785
  • HISTORY.rst: Correct neighbor_iter() replacement in 2.0.0 #1807
  • docs: Always link to stable version #1810
  • Remove exclude_none_values #1813

v2.1.1

30 Jul 16:07
@rht rht
Compare
Choose a tag to compare

This release improves the introductory and visualization tutorial. Ensures both are Google Colab compatible with working badges.

Changes:

  • Update intro_tutorial to warn users to ensure up to date version, and make colab compatible #1739, #1744
  • Improve new/experimental Solara based visualization to ensure pause button works #1745
  • Fix bug in space.py -> get_heading() #1739