Skip to content

Commit 6dabdbf

Browse files
authored
Write initial Mesa Migration guide (#2257)
Contains a rough outline for a Mesa Migration guide, including Mesa 3.0. Includes something on Reserved and private variables, Removal of mesa.flat namespace, Automatic increase of the `steps` counter Will be expanded further - help appreciated!
1 parent 64524f1 commit 6dabdbf

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ ABM features users have shared that you may want to use in your model
8181
Mesa Overview <overview>
8282
tutorials/intro_tutorial
8383
tutorials/visualization_tutorial
84+
Migration guide <migration_guide>
8485
Best Practices <best-practices>
8586
How-to Guide <howto>
8687
API Documentation <apis/api_main>

docs/migration_guide.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Mesa Migration guide
2+
This guide contains breaking changes between major Mesa versions and how to resolve them.
3+
4+
Non-breaking changes aren't included, for those see our [Release history](https://github.com/projectmesa/mesa/releases).
5+
6+
## Mesa 3.0
7+
<!-- TODO small introduction-->
8+
9+
_This guide is a work in progress. The development of it is tracked in [Issue #2233](https://github.com/projectmesa/mesa/issues/2233)._
10+
11+
### Reserved and private variables
12+
<!-- TODO: Update this section based on https://github.com/projectmesa/mesa/discussions/2230 -->
13+
14+
#### Reserved variables
15+
Currently, we have reserved the following variables:
16+
- Model: `agents`, `current_id`, `random`, `running`, `steps`, `time`.
17+
- Agent: `unique_id`, `model`.
18+
19+
You can use (read) any reserved variable, but Mesa may update them automatically and rely on them, so modify/update at your own risk.
20+
#### Private variables
21+
Any variables starting with an underscore (`_`) are considered private and for Mesa's internal use. We might use any of those. Modifying or overwriting any private variable is at your own risk.
22+
23+
- Ref: [Discussion #2230](https://github.com/projectmesa/mesa/discussions/2230), [PR #2225](https://github.com/projectmesa/mesa/pull/2225)
24+
25+
26+
### Removal of `mesa.flat` namespace
27+
The `mesa.flat` namespace is removed. Use the full namespace for your imports.
28+
29+
- Ref: [PR #2091](https://github.com/projectmesa/mesa/pull/2091)
30+
31+
32+
### Automatic assignment of `unique_id` to Agents
33+
<!-- TODO -->
34+
35+
- Ref: [PR #2226](https://github.com/projectmesa/mesa/pull/2226)
36+
37+
38+
### AgentSet and `Model.agents`
39+
#### AgentSet
40+
<!-- TODO -->
41+
42+
#### `Model.agents`
43+
<!-- TODO -->
44+
45+
46+
### Time and schedulers
47+
<!-- TODO general explanation-->
48+
49+
#### Automatic increase of the `steps` counter
50+
The `steps` counter is now automatically increased. With each call to `Model.steps()` it's increased by 1, at the beginning of the step.
51+
52+
You can access it by `Model.steps`, and it's internally in the datacollector, batchrunner and the visualisation.
53+
54+
- Ref: [PR #2223](https://github.com/projectmesa/mesa/pull/2223), Mesa-examples [PR #161](https://github.com/projectmesa/mesa-examples/pull/161)
55+
56+
#### Removal of `Model._time` and rename `._steps`
57+
- `Model._time` is removed. You can define your own time variable if needed.
58+
- `Model._steps` steps is renamed to `Model.steps`.
59+
60+
#### Removal of `Model._advance_time()`
61+
- The `Model._advance_time()` method is removed. This now happens automatically.
62+
63+
<!-- TODO deprecate all schedulers? -->
64+
65+
66+
### Visualisation
67+
<!-- TODO -->

0 commit comments

Comments
 (0)