Skip to content

docs: fix outdated snippets in overview, best-practices and visualization API pages - #3895

Merged
tpike3 merged 1 commit into
mesa:mainfrom
Shivansh1205:docs/fix-outdated-snippets
Sep 30, 2026
Merged

tpike3 merged 1 commit into
mesa:mainfrom
Shivansh1205:docs/fix-outdated-snippets

Conversation

@Shivansh1205

Copy link
Copy Markdown
Contributor

Pre-PR Checklist

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

Summary

Several docs pages still show code that fails on current Mesa: removed APIs (Model(seed=...), mesa.space), a shuffle_do() call with no method, missing imports, and broken tutorial links.

Bug / Issue

Fixes #3894

The migration guide already documents that seed and mesa.space were removed, but overview.md, best-practices.md and apis/visualization.md were never updated. Copying their snippets gives TypeError or ModuleNotFoundError.

Implementation

docs/best-practices.md

  • Agent example now uses __init__(self, model, ...) / super().__init__(model).
  • Seeding section uses rng= instead of seed=, drops the nonexistent model._seed, mentions self.rng, and correctly says unseeded runs draw from OS entropy.
  • Replaced the hard-coded random output with a reproducibility check that still holds.

docs/overview.md

  • The continuous space example now uses mesa.experimental.continuous_space.ContinuousSpace / ContinuousSpaceAgent with the [[0, x_max], [0, y_max]] dimensions format, as in the boid_flockers example.
  • The note now says mesa.space has been removed instead of calling it "maintenance-only".
  • agent_group.shuffle_do() is now agent_group.shuffle_do("step").
  • Added the missing Slider and AgentPortrayalStyle imports to the visualization example.

docs/apis/visualization.md

  • seed=None is now rng=None.
  • Tutorial links now point to the current filenames: 6_visualization_basic, 7_visualization_dynamic_agents and 10_visualization_custom.

Testing

I ran a script against this branch (uv run --with-editable ".[viz,network]"). It checks that each old snippet fails and each new snippet works:

old seed fails: object.__init__() takes exactly one argument (the instance to initialize)
old mesa.space fails: No module named 'mesa.space'
old shuffle_do() fails: AgentSet.shuffle_do() missing 1 required positional argument: 'method'
new shuffle_do ok
continuous ok [3. 4.]
repro True

The imports Slider, SolaraViz, make_space_component, make_plot_component and AgentPortrayalStyle all resolve. The new link targets exist under docs/tutorials/.

Additional Notes

Docs-only change, no code changes. I left docs/migration_guide.md alone: its seed= / unique_id examples are intentional historical "before" snippets.

Update docs that still used removed APIs or broken code:
- best-practices: use Agent(model) and rng= instead of seed=/_seed
- overview: replace removed mesa.space.ContinuousSpace with
  mesa.experimental.continuous_space, pass method to shuffle_do,
  add missing Slider/AgentPortrayalStyle imports
- apis/visualization: use rng=None and fix tutorial links

Fixes mesa#3894
@github-actions github-actions Bot added the docs Release notes label label Sep 29, 2026

@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 @Shivansh1205! Any more help with the tutorials would be greatly appreciated to include testing binder and colab links and functioning.

@tpike3
tpike3 merged commit 2ac2da6 into mesa:main Sep 30, 2026
5 checks passed
EwoutH pushed a commit that referenced this pull request Oct 28, 2026
…3895)

Update docs that still used removed APIs or broken code:
- best-practices: use Agent(model) and rng= instead of seed=/_seed
- overview: replace removed mesa.space.ContinuousSpace with
  mesa.experimental.continuous_space, pass method to shuffle_do,
  add missing Slider/AgentPortrayalStyle imports
- apis/visualization: use rng=None and fix tutorial links

Fixes #3894

(cherry picked from commit 2ac2da6)
EwoutH added a commit that referenced this pull request Oct 28, 2026
The backport of #3895 said mesa.space has been removed, which is only
true on main (4.0). In 3.5.x it is still available in maintenance-only mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: overview, best-practices and visualization API pages use removed APIs (seed, mesa.space) and broken snippets

2 participants