You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Add deprecation policy to contributor guide (#2900)
Adds a new "Deprecation Policy" section to our contributor guide, establishing clear guidelines for how we deprecate features in Mesa.
The deprecation policy is structured around a clear 4-step process:
(1) introduce alternative with optional PendingDeprecationWarning
(2) complete prerequisites (docs, migration guide, examples)
(3) add FutureWarning for active deprecation
(4) remove in next major version.
Changes the active deprecation warning from DeprecationWarning to FutureWarning, which is visible to users by default. This is important since Mesa's deprecated methods live in imported modules, not user scripts, so DeprecationWarning would be hidden even when users run code in __main__.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+82Lines changed: 82 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,6 +197,88 @@ To create a new release, follow these steps:
197
197
198
198
A recorded video of this process is [available here](https://youtu.be/JE44jkegmns).
199
199
200
+
### Deprecation policy
201
+
Mesa follows [Semantic Versioning](https://semver.org/) (SemVer) and has a structured deprecation process to ensure users have time to migrate to new APIs while maintaining backward compatibility.
202
+
203
+
#### Deprecation process
204
+
##### Step 1: Introduce alternative
205
+
When implementing a replacement feature:
206
+
207
+
- Add the new, stable alternative
208
+
- Optionally add a `PendingDeprecationWarning` to the old feature (signals intent in source code, hidden by default)
209
+
210
+
```python
211
+
warnings.warn(
212
+
"old_feature() will be deprecated in a future release. "
213
+
"Use new_feature() instead.",
214
+
PendingDeprecationWarning,
215
+
stacklevel=2,
216
+
)
217
+
```
218
+
219
+
##### Step 2: Complete prerequisites
220
+
Before active deprecation, all of the following must be complete:
221
+
222
+
1.**Documentation updated**: All relevant docs and tutorials reflect the new approach
223
+
2.**Migration guide entry added**: Clear entry in the [Migration Guide](https://github.com/projectmesa/mesa/blob/main/docs/migration_guide.md) explaining what changed and how to update code
224
+
3.**Examples updated**: All example models use the new API
225
+
226
+
##### Step 3: Active deprecation
227
+
The alternative must be available for *at least one minor release* before adding a `FutureWarning`. This warning is visible to all users by default.
228
+
229
+
```python
230
+
warnings.warn(
231
+
"old_feature() is deprecated and will be removed in Mesa X.0. "
| Add alternative + `PendingDeprecationWarning`| Any release |
246
+
| Add `FutureWarning`| Minor release (patch only with compelling reason) |
247
+
| Remove deprecated feature | Major release only |
248
+
249
+
#### Experimental features
250
+
For features in `mesa.experimental`, steps 1–3 can be done simultaneously, and step 4 can occur in any subsequent release (including minor/patch). Experimental features:
251
+
252
+
- Can be changed or removed in any release
253
+
- Don't require a deprecation warning period
254
+
- Should still communicate changes through release notes
255
+
256
+
Following the full process is encouraged when feasible.
257
+
258
+
#### Migration guide entry format
259
+
Place new entries at the top (newest first). Include:
0 commit comments