Repository navigation
Fix stale time-tracking guidance in event scheduling tutorial - #3681
Merged
Merged
Conversation
EwoutH
approved these changes
Apr 9, 2026
EwoutH
left a comment
Member
There was a problem hiding this comment.
Thanks, nice cleanup.
PS: For such small PRs one or two paragraphs of PR description is fine. We're over the GSoC peak it seems.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Summary
Fixes stale guidance in
docs/tutorials/3_event_scheduling.ipynbafter the removal ofmodel.steps.The tutorial was still describing
model.stepsas a built-in Mesa time-tracking attribute, which no longer matches current Mesa behavior. It also had a commented-out Colab install cell and a sample exchange method whose docstring said "random other agent" while the code could still selectself.Bug / Issue
Related issue: #3679
The event scheduling tutorial had a few documentation bugs:
model.stepsandmodel.timeas Mesa's two time-tracking attributes, even thoughmodel.stepshas been removed.stepscounter, which could mislead readers into thinking this was framework behavior.Citizen.exchange()example said it gives money to a "random other agent", but the implementation could choose the current agent.Expected behavior:
model.timeaccurately and present any step counter as user-defined example state.Actual behavior:
Implementation
Updated
docs/tutorials/3_event_scheduling.ipynbto align the tutorial with the current Mesa API and tutorial behavior:model.stepsas a built-in attribute.model.time.stepstostep_countto make it explicit that this is user-defined example state.%pip install --quiet mesa[rec]cell.Citizen.exchange()example to excludeselfso it truly selects another agent.Testing
python3 -m json.tool docs/tutorials/3_event_scheduling.ipynb.Additional Notes
This is a documentation bug fix only; no library runtime behavior was changed.
Closes #3679
GSoC contributor checklist
Context & motivation
I came across this while reviewing the event scheduling tutorial and comparing it with the current Mesa API. The notebook still referred to
model.stepsas if it were a built-in time-tracking attribute, which confused me because the codebase and recent changes are clearly centered aroundmodel.time. I wanted to fix it because tutorials are often the first thing new contributors and users rely on, so even small inconsistencies can create a lot of unnecessary confusion. What interested me here was that this looked like a small documentation issue at first, but it actually required understanding how the event system currently works and how the tutorial examples were communicating that behavior.What I learned
While working on this, I learned more about how Mesa's event-based time progression is implemented and how
run_for()/run_until()relate to the model'sstep()method. I also learned that documentation fixes can be a little trickier than they seem, because the goal is not just to make the text technically correct, but to make sure the examples, explanations, and code all stay aligned with each other. One thing that stood out to me was how easy it is for an example to keep "working" even when the explanation around it has become outdated, like with the manually defined step counter in the notebook.Learning repo
🔗 My learning repo: https://github.com/falloficarus22/GSoC-learning-spac.git
🔗 Relevant model(s):
Readiness checks
pytest --cov=mesa tests/)ruff check . --fix)