diff --git a/docs/migration_guide.md b/docs/migration_guide.md index 1c0d64afd1a..1422d272b47 100644 --- a/docs/migration_guide.md +++ b/docs/migration_guide.md @@ -146,7 +146,7 @@ You can access it by `Model.steps`, and it's internally in the datacollector, ba - The `Model._advance_time()` method is removed. This now happens automatically. #### Replacing Schedulers with AgentSet functionality -The whole Time module in Mesa is deprecated, and all schedulers are being replaced with AgentSet functionality and the internal `Model.steps` counter. This allows much more flexibility in how to activate Agents and makes it explicit what's done exactly. +The whole Time module in Mesa is deprecated and will be removed in Mesa 3.1. All schedulers should be replaced with AgentSet functionality and the internal `Model.steps` counter. This allows much more flexibility in how to activate Agents and makes it explicit what's done exactly. Here's how to replace each scheduler: diff --git a/mesa/agent.py b/mesa/agent.py index ba94f025ee1..5504e1be06b 100644 --- a/mesa/agent.py +++ b/mesa/agent.py @@ -178,7 +178,7 @@ def select( """ if n is not None: warnings.warn( - "The parameter 'n' is deprecated. Use 'at_most' instead.", + "The parameter 'n' is deprecated and will be removed in Mesa 3.1. Use 'at_most' instead.", DeprecationWarning, stacklevel=2, ) @@ -287,8 +287,9 @@ def do(self, method: str | Callable, *args, **kwargs) -> AgentSet: return_results = False else: warnings.warn( - "Using return_results is deprecated. Use AgenSet.do in case of return_results=False, and " - "AgentSet.map in case of return_results=True", + "Using return_results is deprecated and will be removed in Mesa 3.1." + "Use AgenSet.do in case of return_results=False, and AgentSet.map in case of return_results=True", + DeprecationWarning, stacklevel=2, ) diff --git a/mesa/model.py b/mesa/model.py index f9c0e2e4869..57af030e4b4 100644 --- a/mesa/model.py +++ b/mesa/model.py @@ -114,7 +114,7 @@ def _wrapped_step(self, *args: Any, **kwargs: Any) -> None: def next_id(self) -> int: # noqa: D102 warnings.warn( - "using model.next_id() is deprecated. Agents track their unique ID automatically", + "using model.next_id() is deprecated and will be removed in Mesa 3.1. Agents track their unique ID automatically", DeprecationWarning, stacklevel=2, ) @@ -146,8 +146,8 @@ def agents_by_type(self) -> dict[type[Agent], AgentSet]: def get_agents_of_type(self, agenttype: type[Agent]) -> AgentSet: """Deprecated: Retrieves an AgentSet containing all agents of the specified type.""" warnings.warn( - f"Model.get_agents_of_type() is deprecated, please replace get_agents_of_type({agenttype})" - f"with the property agents_by_type[{agenttype}].", + f"Model.get_agents_of_type() is deprecated and will be removed in Mesa 3.1." + f"Please replace get_agents_of_type({agenttype}) with the property agents_by_type[{agenttype}].", DeprecationWarning, stacklevel=2, ) @@ -262,7 +262,7 @@ def initialize_data_collector( """ warnings.warn( - "initialize_data_collector() is deprecated. Please use the DataCollector class directly. " + "initialize_data_collector() is deprecated and will be removed in Mesa 3.1. Please use the DataCollector class directly. " "by using `self.datacollector = DataCollector(...)`.", DeprecationWarning, stacklevel=2, diff --git a/mesa/time.py b/mesa/time.py index f4501b06063..271dcf9f394 100644 --- a/mesa/time.py +++ b/mesa/time.py @@ -1,7 +1,7 @@ """Mesa Time Module. .. warning:: - The time module and all its Schedulers are deprecated and will be removed in a future version. + The time module and all its Schedulers are deprecated and will be removed in Mesa 3.1. They can be replaced with AgentSet functionality. See the migration guide for details: https://mesa.readthedocs.io/latest/migration_guide.html#time-and-schedulers @@ -63,7 +63,7 @@ def __init__(self, model: Model, agents: Iterable[Agent] | None = None) -> None: """ warnings.warn( - "The time module and all its Schedulers are deprecated and will be removed in a future version. " + "The time module and all its Schedulers are deprecated and will be removed in Mesa 3.1. " "They can be replaced with AgentSet functionality. See the migration guide for details. " "https://mesa.readthedocs.io/latest/migration_guide.html#time-and-schedulers", DeprecationWarning, @@ -375,7 +375,7 @@ def get_type_count(self, agenttype: type[Agent]) -> int: class DiscreteEventScheduler(BaseScheduler): - """This class has been deprecated and replaced by the functionality provided by experimental.devs.""" + """This class has been removed and replaced by the functionality provided by experimental.devs.""" def __init__(self, model: Model, time_step: TimeT = 1) -> None: """Initialize DiscreteEventScheduler. @@ -387,5 +387,5 @@ def __init__(self, model: Model, time_step: TimeT = 1) -> None: """ super().__init__(model) raise Exception( - "DiscreteEventScheduler is deprecated in favor of the functionality provided by experimental.devs" + "DiscreteEventScheduler is removed in favor of the functionality provided by experimental.devs" )