Skip to content

Fix #2904: Update experimental cell_space import to mesa.discrete_space#2908

Merged
EwoutH merged 1 commit intomesa:mainfrom
Tejasv-Singh:fix-issue-2904-cell-space-import
Dec 2, 2025
Merged

Fix #2904: Update experimental cell_space import to mesa.discrete_space#2908
EwoutH merged 1 commit intomesa:mainfrom
Tejasv-Singh:fix-issue-2904-cell-space-import

Conversation

@Tejasv-Singh
Copy link
Copy Markdown
Contributor

This PR addresses a deprecation around the old experimental cell space import used in the matplotlib components tests. The tests were importing grid classes from mesa.experimental.cell_space, which is now deprecated in favor of the new mesa.discrete_space API.

What does this PR change?

Updates the import in tests/test_components_matplotlib.py from:

from mesa.experimental.cell_space import (
CellAgent,
HexGrid,
Network,
OrthogonalMooreGrid,
VoronoiGrid,
)

to:

from mesa.discrete_space import (
CellAgent,
HexGrid,
Network,
OrthogonalMooreGrid,
VoronoiGrid,
)

This resolves item 1.3 from issue #2904 by pointing the tests at the official, non‑experimental cell space
implementation.

How did you test it?

Ran the targeted test file:

pytest tests/test_components_matplotlib.py

Re-ran the same test with warnings enabled:

pytest -W always tests/test_components_matplotlib.py

All 7 tests passed, and the previous DeprecationWarning about mesa.experimental.cell_space no longer appears (only unrelated existing warnings remain).

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 2, 2025

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔴 +5.1% [+3.9%, +6.3%] 🔵 +0.6% [+0.4%, +0.8%]
BoltzmannWealth large 🔵 +0.3% [-0.5%, +1.1%] 🔵 +0.8% [-2.1%, +4.3%]
Schelling small 🔵 +0.3% [+0.1%, +0.6%] 🔵 +0.3% [+0.2%, +0.5%]
Schelling large 🔵 +0.3% [-0.4%, +1.1%] 🔵 +0.6% [-1.4%, +2.4%]
WolfSheep small 🔵 +0.5% [+0.1%, +0.8%] 🔵 +0.6% [+0.4%, +0.7%]
WolfSheep large 🔵 +1.0% [+0.0%, +2.4%] 🔵 +1.1% [-1.7%, +3.8%]
BoidFlockers small 🟢 -4.4% [-5.2%, -3.4%] 🔵 -0.2% [-0.5%, +0.0%]
BoidFlockers large 🟢 -4.1% [-4.9%, -3.3%] 🔵 -0.4% [-0.8%, +0.1%]

@EwoutH EwoutH added the ignore-for-release PRs that aren't included in the release notes label Dec 2, 2025
@EwoutH EwoutH merged commit 41f3028 into mesa:main Dec 2, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release PRs that aren't included in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants