Skip to content

Commit e1d4811

Browse files
authored
best-practices: Update Model Layout section (#2424)
Update the Model Layout section of the best-practices to the current way we structure our examples.
1 parent 9e45708 commit e1d4811

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

docs/best-practices.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,21 @@ Here are some general principles that have proven helpful for developing models.
55
## Model Layout
66

77
A model should be contained in a folder named with lower-case letters and
8-
underscores, such as `thunder_cats`. Within that directory:
9-
10-
- `README.md` describes the model, how to use it, and any other details.
11-
Github will automatically show this file to anyone visiting the directory.
12-
- `model.py` should contain the model class. If the file gets large, it may
13-
make sense to move the complex bits into other files, but this is the first
14-
place readers will look to figure out how the model works.
15-
- `server.py` should contain the visualization support, including the server
16-
class.
17-
- `run.py` is a Python script that will run the model when invoked via
18-
`mesa runserver`.
19-
20-
After the number of files grows beyond a half-dozen, try to use sub-folders to
21-
organize them. For example, if the visualization uses image files, put those in
22-
an `images` directory.
23-
24-
The [Schelling](https://github.com/projectmesa/mesa-examples/tree/main/examples/schelling) model is
25-
a good example of a small well-packaged model.
8+
underscores, such as `wolf_sheep`. Within that directory:
9+
10+
- `Readme.md` describes the model, how to use it, and any other details.
11+
- `model.py` should contain the model class.
12+
- `agents.py` should contain the agent class(es).
13+
- `app.py` should contain the Solara-based visualization code (optional).
14+
15+
You can add more files as needed, for example:
16+
- `run.py` could contain the code to run the model.
17+
- `batch_run.py` could contain the code to run the model multiple times.
18+
- `analysis.py` could contain any analysis code.
19+
20+
Input data can be stored in a `data` directory, output data in an `output`, processed results in a `results` directory, images in an `images` directory, etc.
21+
22+
All our [examples](examples) follow this layout.
2623

2724
## Randomization
2825

0 commit comments

Comments
 (0)