Skip to content

Deprecate the agent and propertylayer portrayal dicts#3144

Merged
EwoutH merged 2 commits intomesa:mainfrom
EwoutH:deprecate_portrayal_dict
Jan 16, 2026
Merged

Deprecate the agent and propertylayer portrayal dicts#3144
EwoutH merged 2 commits intomesa:mainfrom
EwoutH:deprecate_portrayal_dict

Conversation

@EwoutH
Copy link
Copy Markdown
Member

@EwoutH EwoutH commented Jan 15, 2026

Summary

Updates deprecation warnings for visualization portrayal components to specify "will be removed in Mesa 4.0" and upgrades warnings from PendingDeprecationWarning to FutureWarning (following our deprecation policy).

What's Deprecated

  • Returning dictionaries from agent_portrayal functions
  • Returning dictionaries from propertylayer_portrayal
  • Passing portrayal arguments directly to draw_agents() and draw_propertylayer() methods

Migration

Use AgentPortrayalStyle and PropertyLayerStyle instead of dictionaries:

# Old
def agent_portrayal(agent):
    return {"color": "red", "marker": "s", "size": 30}

# New
def agent_portrayal(agent):
    return AgentPortrayalStyle(color="red", marker="s", size=30)

For draw_agents() and draw_propertylayer(), use setup_agents() and setup_propertylayer() before calling the draw methods.

See the migration guide for details.

Update deprecation warnings in visualization backends and renderers to specify removal in Mesa 4.0. Updated warning types from PendingDeprecationWarning to FutureWarning where appropriate, and clarified migration guidance for agent_portrayal and propertylayer_portrayal usage.
@EwoutH EwoutH added the deprecation When a new deprecation is introduced label Jan 15, 2026
@github-actions

This comment was marked as off-topic.

The test now calls sr.setup_propertylayer(style).draw_propertylayer() instead of sr.draw_propertylayer(style).
@EwoutH EwoutH changed the title Deprecate the agent_portrayal dict Deprecate the agent and propertylayer portrayal dicts Jan 16, 2026
@EwoutH EwoutH merged commit 32e3b4c into mesa:main Jan 16, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecation When a new deprecation is introduced

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants