Skip to content

Update Conway Streamlit example for current grid API - #3781

Merged
tpike3 merged 1 commit into
mesa:mainfrom
falloficaruss:fix/conway-streamlit-grid-iteration
Aug 5, 2026
Merged

tpike3 merged 1 commit into
mesa:mainfrom
falloficaruss:fix/conway-streamlit-grid-iteration

Conversation

@falloficaruss

Copy link
Copy Markdown
Contributor

Note

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.

Pre-PR Checklist

  • This PR is a bug fix, not a new feature or enhancement.

Summary

The Conway Streamlit example still used the removed grid.coord_iter() API. When a user runs the simulation, the app raises an AttributeError during the first grid update, so the visualization cannot proceed.
Impact: this affects only the Streamlit Conway example, not Mesa’s core grid functionality or the underlying Conway model. Updating it to iterate over grid.all_cells restores the example’s compatibility with the current discrete-space API.

Bug / Issue

Closes #3770

Implementation

Updated st_app.py to replace model.grid.coord_iter() with model.grid.all_cells.

Testing

All tests pass

Additional Notes

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 -1.6% [-2.0%, -1.3%] 🟢 -4.2% [-4.5%, -3.9%]
BoltzmannWealth large 🔵 -1.4% [-1.9%, -0.8%] 🟢 -5.0% [-5.3%, -4.6%]
Schelling small 🔵 -1.3% [-1.7%, -0.9%] 🟢 -4.5% [-5.1%, -3.9%]
Schelling large 🔵 -0.3% [-1.1%, +0.5%] 🔵 -0.0% [-1.0%, +0.9%]
WolfSheep small 🔵 -2.2% [-2.6%, -1.8%] 🔵 -2.0% [-5.9%, +1.9%]
WolfSheep large 🔵 -3.0% [-3.5%, -2.6%] 🔵 -2.4% [-2.9%, -1.9%]
SugarscapeG1mt small 🔵 -0.9% [-1.1%, -0.6%] 🔵 -1.5% [-3.2%, +0.5%]
SugarscapeG1mt large 🔵 -0.7% [-1.4%, +0.2%] 🔵 +0.0% [-2.4%, +2.0%]
BoidFlockers small 🔵 -0.2% [-0.5%, +0.1%] 🔵 +0.2% [-0.2%, +0.5%]
BoidFlockers large 🔵 +0.4% [-0.1%, +0.9%] 🔵 -0.7% [-1.0%, -0.3%]

@tpike3 tpike3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @falloficaruss!

@tpike3
tpike3 merged commit 1d7b3fe into mesa:main Aug 5, 2026
10 of 12 checks passed
@falloficaruss
falloficaruss deleted the fix/conway-streamlit-grid-iteration branch August 5, 2026 10:37
EwoutH pushed a commit that referenced this pull request Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Conway Streamlit example grid iteration

2 participants