Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure reference is resolved when passing options to from_param #6762

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion panel/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def action(event):
watchers.append(self.object.param.watch(link, p_name, 'step'))
watchers.append(self.object.param.watch(link, p_name))

options = kwargs.get('options', [])
options = resolve_value(kwargs.get('options', []), recursive=False)
if isinstance(options, dict):
options = options.values()
if ((is_parameterized(value) or any(is_parameterized(o) for o in options))
Expand Down
18 changes: 18 additions & 0 deletions panel/tests/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,24 @@ class Test(param.Parameterized):
assert w.value == (1, 2)


def test_from_param_with_ref_as_option():
class Test(param.Parameterized):
s = param.String(default='A')

@param.depends('s')
def ref(self):
return [self.s] + ['B']

t = Test()
w = AutocompleteInput.from_param(t.param.s, options=t.ref)

assert w.options == ['A', 'B']

t.s = 'C'

assert w.options == ['C', 'B']


def test_paramfunction_bare_emits_warning(caplog):

def foo():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def run(self):

install_requires = [
'bokeh >=3.4.0,<3.5.0',
'param >=2.0.0,<3.0',
'param >=2.1.0,<3.0',
philippjfr marked this conversation as resolved.
Show resolved Hide resolved
'pyviz_comms >=2.0.0',
'xyzservices >=2021.09.1', # Bokeh dependency, but pyodide 23.0.0 does not always pick it up
'markdown',
Expand Down
Loading