Skip to content

Deprecate Simulator classes, add migration guide entry#3277

Merged
EwoutH merged 3 commits intomesa:mainfrom
EwoutH:depr_simulators
Feb 11, 2026
Merged

Deprecate Simulator classes, add migration guide entry#3277
EwoutH merged 3 commits intomesa:mainfrom
EwoutH:depr_simulators

Conversation

@EwoutH
Copy link
Copy Markdown
Member

@EwoutH EwoutH commented Feb 11, 2026

Summary

Deprecates the experimental Simulator, ABMSimulator, and DEVSimulator classes in favor of the new public event scheduling API introduced in #3266. Adds corresponding migration guide entry.

Implementation

  • Adds FutureWarning to ABMSimulator and DEVSimulator __init__ methods
  • Adds deprecation notices to class and module docstrings
  • Adds migration guide section showing how to replace Simulator usage with the new Model methods
  • Links all deprecation warnings to the migration guide

The Simulators will be removed in Mesa 4.0. All functionality is now available directly on Model via:

  • model.run_for(duration)
  • model.run_until(end_time)
  • model.schedule_event(func, *, at, after)
  • model.schedule_recurring(func, schedule)

Migration Guide Entry

The guide shows:

  • Replacing step loops with run_for() and run_until()
  • One-off event scheduling with at= and after=
  • Recurring events with Schedule objects
  • Direct migration from ABMSimulator and DEVSimulator

Additional Notes

This deprecation is non-breaking, existing code using Simulators continues to work with warnings. The new API (#3266) will be available in Mesa 3.5, giving users one major version to migrate before removal in Mesa 4.0.

We could move more aggressive and directly remove it, which is allowed for experimental features in our deprecation policy, but this feature has been with us for a long time, so let's deprecate it gently.

Ref: Discussion #2921, PR #3266

@EwoutH EwoutH added docs Release notes label deprecation When a new deprecation is introduced labels Feb 11, 2026
@EwoutH EwoutH requested a review from quaquel February 11, 2026 12:40
@github-actions
Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +0.2% [-0.5%, +1.0%] 🔵 -1.6% [-1.8%, -1.4%]
BoltzmannWealth large 🔵 +0.9% [-0.1%, +1.8%] 🔵 +0.2% [-2.5%, +2.9%]
Schelling small 🔵 +0.6% [+0.2%, +1.0%] 🔵 -1.5% [-1.9%, -1.1%]
Schelling large 🔵 +0.3% [-0.3%, +1.0%] 🔵 -2.6% [-4.7%, -1.0%]
WolfSheep small 🔵 +0.6% [-0.0%, +1.2%] 🔵 -0.4% [-1.4%, +0.6%]
WolfSheep large 🔵 +0.3% [-1.0%, +1.8%] 🔵 +2.9% [-0.5%, +6.5%]
BoidFlockers small 🔵 +2.3% [+1.9%, +2.8%] 🔵 +1.5% [+1.3%, +1.7%]
BoidFlockers large 🔵 +0.6% [-0.3%, +1.3%] 🔵 -0.2% [-1.0%, +0.3%]

@quaquel
Copy link
Copy Markdown
Member

quaquel commented Feb 11, 2026

What's up with the failed tests? Is it just the depreciation warnings?

Copy link
Copy Markdown
Member

@quaquel quaquel left a comment

Choose a reason for hiding this comment

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

One minor comment.

@EwoutH
Copy link
Copy Markdown
Member Author

EwoutH commented Feb 11, 2026

What's up with the failed tests? Is it just the depreciation warnings?

Yes, I have supressed some expected once, and the remaining one disappears after the wolf-sheep example is updated (#3278).

Document new Mesa 3.5 APIs for event scheduling and time advancement on Model. Adds examples for run_for/run_until (replacing step loops), schedule_event (at/after), and schedule_recurring (with Schedule and control via start/stop/count). Also documents deprecation of experimental Simulator classes with equivalent Model usages and notes that 3.5 is non-breaking but Mesa 4 will remove deprecated components.
Mark Simulator/ABMSimulator/DEVSimulator as deprecated in the module/class docstrings and add FutureWarning notices in ABMSimulator.__init__ and DEVSimulator.__init__. The messages point users to the new Model APIs (run_for, run_until, schedule_event, schedule_recurring) and the migration guide, and note removal in Mesa 4.0. No behavioral changes beyond emitting deprecation warnings.
@EwoutH
Copy link
Copy Markdown
Member Author

EwoutH commented Feb 11, 2026

That's a lot of green!

@EwoutH EwoutH merged commit 61da796 into mesa:main Feb 11, 2026
15 checks passed
@EwoutH EwoutH mentioned this pull request Feb 11, 2026
42 tasks
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 docs Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants