holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.64k stars 504 forks source link

ValueError when using inclusive_bounds #6996

Open MarcSkovMadsen opened 2 months ago

MarcSkovMadsen commented 2 months ago

I'm working on adding support for Pydantic dataclasses to Panel when I stumbled upon this bug

import param
import panel as pn

pn.extension()

class SomeModel(param.Parameterized):
    int_field = param.Integer(default=1, bounds=(0,10), inclusive_bounds=(False, False))
    float_field = param.Integer(default=1, bounds=(0, 10), inclusive_bounds=(False, False))

model = SomeModel()

pn.Param(model).servable()

If you drag either of the the slider to the end you will get one of

ValueError: Integer parameter 'SomeModel.float_field' must be less than 10, not 10.
ValueError: Integer parameter 'SomeModel.float_field' must be less than 10, not 10.
ahuang11 commented 2 months ago

The bug here is that the Panel slider allows user sliding to 0 and 10 in the UI.

I was initially confused because inclusive_bounds=False should error on 0/10.