RSDK-13355: remove reconfigure#1167
Conversation
9a2f335 to
7a26220
Compare
| from viam.proto.app.robot import ComponentConfig | ||
| from viam.proto.common import ResourceName | ||
| from viam.resource.base import ResourceBase | ||
|
|
||
|
|
||
| @runtime_checkable | ||
| class Reconfigurable(Protocol): |
There was a problem hiding this comment.
Should we remove this class completely? Or not, because it would crash at runtime for users who bump the SDK version but forget to remove it from their code?
There was a problem hiding this comment.
Let's keep it for now, but can you add a deprecated warning to it please?
There was a problem hiding this comment.
You mean use __init_subclass__ or something so it prints at runtime when something subclasses this?
There was a problem hiding this comment.
Yeah exactly. Not sure if __init_subclass__ works for protocols. If not, maybe we do just remove the protocl. I think it's been removed in the other SDKs already, correct?
There was a problem hiding this comment.
__init_subclass__ works for me:
$ python3 -W always # always show warnings
Python 3.13.12 (main, Feb 3 2026, 17:53:27) [GCC 15.2.0] on linux
>>> from viam.module.types import Reconfigurable
>>> class Test(Reconfigurable):
... pass
...
<frozen abc>:106: DeprecationWarning: Reconfigure is deprecated, and resources will always rebuild. It is not necessary to implement Reconfigurable.$ git diff src/viam/module/types.py
diff --git a/src/viam/module/types.py b/src/viam/module/types.py
index 4930653426..3ac0e77067 100644
--- a/src/viam/module/types.py
+++ b/src/viam/module/types.py
@@ -1,9 +1,12 @@
from typing import Any, Mapping, Optional, Protocol, runtime_checkable
+import warnings
@runtime_checkable
class Reconfigurable(Protocol):
"""The Reconfigurable protocol defines the requirements for making a resource Reconfigurable"""
+ def __init_subclass__(*args, **kwargs):
+ warnings.warn("Reconfigure is deprecated, and resources will always rebuild. It is not necessary to implement Reconfigurable.", DeprecationWarning, stacklevel=2)I think it's been removed in the other SDKs already, correct?
Yes, it's completely removed in C++ already, and will be in Go once the main PR gets merged.
njooma
left a comment
There was a problem hiding this comment.
Looks good! 2 things:
- Add the deprecated warning to
Reconfigurableprotocol - Can you do a search over the python repo for
reconfigure? There are still a few places in (particularly docs) where we have outdated information
| from viam.proto.app.robot import ComponentConfig | ||
| from viam.proto.common import ResourceName | ||
| from viam.resource.base import ResourceBase | ||
|
|
||
|
|
||
| @runtime_checkable | ||
| class Reconfigurable(Protocol): |
There was a problem hiding this comment.
Let's keep it for now, but can you add a deprecated warning to it please?
stuqdog
left a comment
There was a problem hiding this comment.
lgtm, modulo Naveed's comments.
|
@aldenh-viam checking in on status -- trying to avoid becoming stale |
LMK about my question in the above thread. Are you looking for a deprecation warning to print at runtime or just a comment? I searched the repo, but can't tell if there's an existing style I should follow. |
f2bc074 to
9da487d
Compare
Modules no longer need to implement
Reconfigureafter viamrobotics/rdk#5811, sinceReconfigureResourcewill not be called byviam-serveranymore and it will instead always close (RemoveResource) and recreate (AddResource) the resource.