holoviz / param

Param: Make your Python code clearer and more reliable by declaring Parameters
https://param.holoviz.org
BSD 3-Clause "New" or "Revised" License
412 stars 69 forks source link

Ensure Parameter re-validates default if slot changes #820

Closed philippjfr closed 9 months ago

philippjfr commented 10 months ago

This PR adds validation when overriding slot values on a Parameter in a subclass. It does this by checking if a superclass defines a slot value and if that slot value is overridden by the subclass. It attempts to minimize the number of actual lookups by aborting early if we already know that re-validation has to happen and by skipping checks on various slot values which do not affect validation.

Fixes https://github.com/holoviz/param/issues/714

philippjfr commented 10 months ago

I had to disable re-validation of None values because the automatic appending of an unknown value on Selector opens a whole rabbit hole in regard to the validation.

philippjfr commented 9 months ago

@maximlt Can you either merge or ask for further clarification? You are release manager :)

maximlt commented 9 months ago

I was waiting for https://github.com/holoviz/param/pull/826 to be merged! Now it's done I'll rebase this and merge if it goes well.