Deprecate world.add without physics specified
This will print a warning and produce an error in the next major version.
@@ -5,7 +5,7 @@ Worlds also facilitate referencing states when performing a forward simulation.
A default World, called `world` is provided for convenience.
"""
-
+import warnings
from typing import TypeVar
import inspect
@@ -202,6 +202,7 @@ Adds a State to the world that will be stepped forward in time each time world.s
:return: StateProxy referencing the current state of the added system. If world.state is updated (e.g. because world.step() was called), the StateProxy will refer to the updated values.
"""
if physics is not None:
+ warnings.warn('No physics provided to world.add(%s). This will result in an error in the future.' % state)
assert isinstance(physics, Physics)
self.physics.add(state.name, physics)
self.state = self.state.state_added(state)
