Skip to content

Fix shape_example: migrate from ModularServer to SolaraViz (Mesa 3.x)#380

Open
Harshini2411 wants to merge 22 commits intomesa:mainfrom
Harshini2411:fix/shape-example-charts
Open

Fix shape_example: migrate from ModularServer to SolaraViz (Mesa 3.x)#380
Harshini2411 wants to merge 22 commits intomesa:mainfrom
Harshini2411:fix/shape-example-charts

Conversation

@Harshini2411
Copy link

@Harshini2411 Harshini2411 commented Mar 12, 2026

Partially addresses #358

Changes

shape_example:

  • Deleted server.py (old ModularServer approach)
  • Created app.py using SolaraViz + make_space_component
  • Updated Walker to extend CellAgent, added step() method
  • Updated run.py
  • Note: arrowHead not supported in Mesa 3.x, replaced with marker="^"

charts:

  • Deleted server.py (old ModularServer approach)
  • Created app.py using SolaraViz, make_space_component, make_plot_component
  • Uses AgentPortrayalStyle to fix FutureWarning
  • Uses solara.Reactive to fix render loop
  • Updated run.py

Fixes #358

@Harshini2411
Copy link
Author

Harshini2411 commented Mar 12, 2026

@quaquel ready for review! This PR fixes both shape_example and charts,
fully addressing #358. Could you approve the CI workflow? Thank you!

@EwoutH
Copy link
Member

EwoutH commented Mar 15, 2026

Cool, these visualisation updates are appreciated!

Could you:

  • Checkout the test failure
  • Add a screenshot or gif of the visualisation to the PR description
  • Request a peer-review (and maybe do one or two yourself)

@Harshini2411
Copy link
Author

Hi @EwoutH! Thanks for the feedback!

  • CI failure fixed ,the issue was a UTF-16 encoded .gitignore file, converted to UTF-8
  • Added screenshots of both shape_example and charts visualizations to the PR description
  • Shape_Example
Shape_example
  • Charts
charts

Please let me know if anything else needs to be addressed!

@Harshini2411 Harshini2411 force-pushed the fix/shape-example-charts branch from bb15003 to 5d25dbc Compare March 16, 2026 22:08
Harshini2411 and others added 16 commits March 16, 2026 17:11
- Renamed server.py to app.py with SolaraViz implementation
- Updated run.py to import from app.py
- Deleted portrayal.py (replaced by agent_portrayal in app.py)

Fixes mesa#358
- Deleted server.py (old ModularServer + CanvasGrid approach)
- Created app.py using SolaraViz + make_space_component
- Updated Walker to use CellAgent for proper grid visualization
- Added step() method to Walker agent
- Updated run.py to import from app.py

Partially addresses mesa#358
@Harshini2411 Harshini2411 force-pushed the fix/shape-example-charts branch from 5d25dbc to 8bec5f6 Compare March 16, 2026 22:12
@Harshini2411
Copy link
Author

@EwoutH Also fixed and tested hex_ant and hex_snowflake locally:

  • hex_ant: restructured into package with nested folder, fixed PropertyLayer .data assignments
hex_ant
  • hex_snowflake: restructured into package with nested folder, fixed imports
hex_snowflake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix hex_snowflake, shape_example, charts: mesa.visualization no longer exists in Mesa 3.x

2 participants