File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ List of currently deprecated APIs:
44
55| Warning | Description |
66| -| -|
7+ | ` ParamFutureWarning ` since ` 2.3.0 ` | Parameterized ` .param ` namespace / ` .param.watch_values ` : the keyword ` what ` is deprecated |
78| ` ParamPendingDeprecationWarning ` since ` 2.3.0 ` | ` param.parameterized ` module / Setting a parameter value before full instance initialization |
89| ` ParamFutureWarning ` since ` 2.2.0 ` , ` ParamDeprecationWarning ` since ` 2.0.0 ` | Parameter slots / ` List._class ` : use instead ` item_type ` |
910| ` ParamFutureWarning ` since ` 2.2.0 ` , ` ParamDeprecationWarning ` since ` 2.0.0 ` | Parameter slots / ` Number.set_hook ` : no replacement |
Original file line number Diff line number Diff line change @@ -4114,6 +4114,8 @@ def watch_values(
41144114 name, a list of parameter names, or a tuple of parameter names.
41154115 what : str, optional
41164116 The type of change to watch for. Must be 'value'. Default is 'value'.
4117+
4118+ .. deprecated:: 2.3.0
41174119 onlychanged : bool, optional
41184120 If True (default), the callback is only invoked when the parameter value
41194121 changes. If False, the callback is invoked even when the parameter is
@@ -4179,6 +4181,13 @@ def watch_values(
41794181 raise ValueError ("User-defined watch callbacks must declare "
41804182 "a positive precedence. Negative precedences "
41814183 "are reserved for internal Watchers." )
4184+ if what != 'value' :
4185+ warnings .warn (
4186+ 'The keyword "what" is deprecated and will be removed in a '
4187+ 'future version.' ,
4188+ category = _ParamFutureWarning ,
4189+ stacklevel = 3 ,
4190+ )
41824191 assert what == 'value'
41834192 if isinstance (parameter_names , list ):
41844193 parameter_names = tuple (parameter_names )
Original file line number Diff line number Diff line change @@ -107,6 +107,17 @@ def __init__(self, **params):
107107 with pytest .raises (param ._utils .ParamPendingDeprecationWarning ):
108108 P ()
109109
110+ def test_deprecate_watch_values_keyword_what (self ):
111+ class P (param .Parameterized ):
112+ x = param .Parameter ()
113+
114+ def __init__ (self , ** params ):
115+ super ().__init__ (** params )
116+ self .param .watch_values (lambda _ : None , ['x' ], 'doc' )
117+
118+ with pytest .raises (param ._utils .ParamFutureWarning ):
119+ P ()
120+
110121
111122class TestDeprecateParameters :
112123
You can’t perform that action at this time.
0 commit comments