holoviz / panel

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

Deprecate `width_policy` and `height_policy` #7492

Open philippjfr opened 1 week ago

philippjfr commented 1 week ago

When first creating Panel I exposed all the base styling and layout related parameters from Bokeh, including sizing_mode, width_policy and height_policy. The thing is though that the width and height policy options effectively offers no more control than the sizing_mode and also less intuitive. Therefore I propose to remove these parameters, making it clear that sizing_mode is how to control these options.

The impact should be minimal as we steered most users towards sizing_mode from the very beginning and with a longer deprecation period with warnings we can give folks time to switch over.

philippjfr commented 1 week ago

@mattpap Could you chime in what isn't covered by the sizing_mode that can be controlled with the policy arguments?

mattpap commented 6 days ago

The point of having width and height polices instead of sizing modes is to:

  1. Have fine and individual control over sizing in either dimensions.
  2. Allow adding new policies without having to invent new sizing modes (e.g. fit policy regardless if it actually works).
  3. Policies should have closer relationship with CSS. Sizing modes were invented primarily for plots.
  4. Sizing modes can affect more than just the policy in either dimension (e.g. they can affect aspect management).