Skip to content

Commit

Permalink
maintenance: updates for 2.2.0 release
Browse files Browse the repository at this point in the history
update `__init__.py`
update `HISTORY.md`
fix ruff failures
  • Loading branch information
tpike3 committed Jan 9, 2024
1 parent d2eb502 commit c2f091d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 9 deletions.
38 changes: 38 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@
title: Release History
---

# 2.2.0 (2024-01-09)

# Highlights
This release incorporates several majors changes to Mesa. Notably, this provides two experimental features. (1) It reimagines Mesa's agent handling to have agents in the model class and store them in sets (you may submit feedback at https://github.com/projectmesa/mesa/discussions/1919). The intent is to make Mesa more efficient and give users more control over agent scheduling to allow for innumerable options. (2) It adds property layer and property grid so users can layer on multiple grids making Mesa and Geo-Mesa more similar (you may submit feedback at https://github.com/projectmesa/mesa/discussions/1932).

# What's Changed

## 🧪 Experimental features
* Introduce AgentSet class by @EwoutH in https://github.com/projectmesa/mesa/pull/1916
* Reimplement schedulers to use AgentSet by @quaquel in https://github.com/projectmesa/mesa/pull/1926
* Work around for initializing model._agent by @quaquel in https://github.com/projectmesa/mesa/pull/1928
* space: Implement PropertyLayer and _PropertyGrid by @EwoutH in https://github.com/projectmesa/mesa/pull/1898

## 🛠 Enhancements made
* Native support for multiple agent types by @EwoutH in https://github.com/projectmesa/mesa/pull/1894
* Document empties property by @EwoutH in https://github.com/projectmesa/mesa/pull/1888
* Add DiscreteEventScheduler by @EwoutH in https://github.com/projectmesa/mesa/pull/1890
* space: Let move_agent choose from multiple positions by @EwoutH in https://github.com/projectmesa/mesa/pull/1920

## 🐛 Bugs fixed
* Honor disabled space drawer option when rendering in the browser by @rlskoeser in https://github.com/projectmesa/mesa/pull/1907

## 📜 Documentation improvements
* docs: Fix README.md inline code formatting by @rht in https://github.com/projectmesa/mesa/pull/1887
* Add experimental warning to DiscreteEventScheduler by @EwoutH in https://github.com/projectmesa/mesa/pull/1924

## 🔧 Maintenance
* ci: Speed up pip install by caching deps install output by @rht in https://github.com/projectmesa/mesa/pull/1885
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/projectmesa/mesa/pull/1899
* build(deps): bump actions/setup-python from 4 to 5 by @dependabot in https://github.com/projectmesa/mesa/pull/1904
* Create release.yml file for automatic release notes generation by @EwoutH in https://github.com/projectmesa/mesa/pull/1925
* Drop support for Python 3.8 by @rht in https://github.com/projectmesa/mesa/pull/1756

## New Contributors
* @quaquel made their first contribution in https://github.com/projectmesa/mesa/pull/1928

**Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.1.5...v2.2.0

# 2.1.5 (2023-11-26)

This release has some critical fixes to JupyterViz/Solara frontend to prevent
Expand Down
2 changes: 1 addition & 1 deletion mesa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
]

__title__ = "mesa"
__version__ = "2.1.5"
__version__ = "2.2.0"
__license__ = "Apache 2.0"
_this_year = datetime.datetime.now(tz=datetime.timezone.utc).date().year
__copyright__ = f"Copyright {_this_year} Project Mesa Team"
4 changes: 1 addition & 3 deletions mesa/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,16 @@ def __init__(self, unique_id: int, model: Model) -> None:
self.model.agentset_experimental_warning_given = False

warnings.warn(
"The Mesa Model class wasn’t initialized. In the future, you need to explicitly initialize the Model by calling super().__init__() on initialization.",
"The Mesa Model class was not initialized. In the future, you need to explicitly initialize the Model by calling super().__init__() on initialization.",
FutureWarning,
stacklevel=2,
)


def remove(self) -> None:
"""Remove and delete the agent from the model."""
with contextlib.suppress(KeyError):
self.model._agents[type(self)].pop(self)


def step(self) -> None:
"""A single step of the agent."""

Expand Down
2 changes: 1 addition & 1 deletion mesa/batchrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def batch_run(


def _make_model_kwargs(
parameters: Mapping[str, Union[Any, Iterable[Any]]]
parameters: Mapping[str, Union[Any, Iterable[Any]]],
) -> list[dict[str, Any]]:
"""Create model kwargs from parameters dictionary.
Expand Down
7 changes: 3 additions & 4 deletions tests/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def test_init(self):
scheduler = RandomActivation(model, agents)
assert all(agent in scheduler.agents for agent in agents)


def test_random_activation_step_shuffles(self):
"""
Test the random activation step
Expand Down Expand Up @@ -226,7 +225,6 @@ def test_get_agent_keys(self):
assert all(entry in agent_ids for entry in keys)



class TestSimultaneousActivation(TestCase):
"""
Test the simultaneous activation.
Expand Down Expand Up @@ -260,7 +258,6 @@ def test_init(self):
scheduler = RandomActivationByType(model, agents)
assert all(agent in scheduler.agents for agent in agents)


def test_random_activation_step_shuffles(self):
"""
Test the random activation by type step
Expand Down Expand Up @@ -301,7 +298,9 @@ def test_random_activation_counts(self):

agent_types = model.agent_types
for agent_type in agent_types:
assert model.schedule.get_type_count(agent_type) == len(model.get_agents_of_type(agent_type))
assert model.schedule.get_type_count(agent_type) == len(
model.get_agents_of_type(agent_type)
)

# def test_add_non_unique_ids(self):
# """
Expand Down

0 comments on commit c2f091d

Please sign in to comment.