-
-
Notifications
You must be signed in to change notification settings - Fork 588
Description
ALL software version info
Software Version Info
panel 1.8.5
Description of expected behavior and the observed behavior
It is possible to set a ready_parameter to a stage when some condition has to be met to proceed. Until it's set to True, the "next" button is disabled. I would expect that this behaviour would remain if you've proceeded to the next stage and then go back to the original stage.
Instead, what happens is that when the ready_parameter is set to True, the "next" button stays disabled so you can't proceed even though you should. On the second time it's set to True though, the "next" button is finally enabled. In fact, since the stage's state has not changed when you go back to it, the "next" button should not be disabled at all.
If I'm unclear, please refer to the attached screencast.
Complete, minimal, self-contained example code that reproduces the issue
I took the code from the docs, added a ready_parameter to the first stage and a button that set it to True when clicked.
import panel as pn
import param
pn.extension("katex")
pipeline = pn.pipeline.Pipeline()
class Stage1(param.Parameterized):
a = param.Integer(default=2, bounds=(0, 10))
b = param.Integer(default=3, bounds=(0, 10))
ready = param.Boolean(default=False)
@param.output(("c", param.Integer), ("d", param.Integer))
def output(self):
return self.a * self.b, self.a**self.b
@param.depends("a", "b")
def view(self):
c, d = self.output()
c_out = pn.pane.LaTeX(
"${a} * {b} = {c}$".format(a=self.a, b=self.b, c=c),
styles={"font-size": "2em"},
)
d_out = pn.pane.LaTeX(
"${a}^{{{b}}} = {d}$".format(a=self.a, b=self.b, d=d),
styles={"font-size": "2em"},
)
button = pn.widgets.Button(
name="Ready",
button_type="success",
on_click=lambda x: setattr(self, "ready", True),
)
return pn.Column(
c_out,
d_out,
button,
margin=(40, 10),
styles={"background": "#f0f0f0"},
)
def panel(self):
return pn.Row(
self.param,
self.view,
)
class Stage2(param.Parameterized):
c = param.Integer(default=6, bounds=(0, None))
exp = param.Number(default=0.1, bounds=(0, 3))
@param.depends("c", "exp")
def view(self):
out = pn.pane.LaTeX(
"${%s}^{%s}={%.3f}$" % (self.c, self.exp, self.c**self.exp),
styles={"font-size": "2em"},
)
return pn.Column(out, margin=(40, 10), styles={"background": "#f0f0f0"})
def panel(self):
return pn.Row(self.param, self.view)
pipeline.add_stage("Stage 1", Stage1, ready_parameter="ready")
pipeline.add_stage("Stage 2", Stage2)
pipeline.servable()Screenshots or screencasts of the bug in action
Capture.video.du.2026-01-20.13-26-53.mp4
- I may be interested in making a pull request to address this