Skip to content

Commit

Permalink
Merge branch 'main' into modal
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Dec 2, 2024
2 parents 94a27fc + b296960 commit fea45f0
Show file tree
Hide file tree
Showing 111 changed files with 1,396 additions and 365 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
name: conda
path: dist/*tar.bz2
if-no-files-found: error
- name: Verify size
run: python scripts/verify_build_size.py conda

conda_publish:
name: Publish Conda
Expand Down Expand Up @@ -106,6 +108,10 @@ jobs:
name: pip
path: dist/
if-no-files-found: error
- name: Verify sizes
run: |
python scripts/verify_build_size.py sdist
python scripts/verify_build_size.py whl
pip_install:
name: Install PyPI
Expand Down Expand Up @@ -165,6 +171,8 @@ jobs:
name: npm
if-no-files-found: error
path: ./${{ env.PACKAGE }}/${{ env.TARBALL }}
- name: Verify size
run: python scripts/verify_build_size.py npm

npm_publish:
name: Publish NPM
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gallery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -e {0}
shell: bash -el {0}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
exclude: \.min\.js$
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.7.0
hooks:
- id: ruff
files: panel/
Expand Down Expand Up @@ -47,7 +47,7 @@ repos:
- id: oxipng
stages: [manual]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.12.0
rev: v9.13.0
hooks:
- id: eslint
args: ['-c', 'panel/.eslintrc.js', 'panel/*.ts', 'panel/models/**/*.ts', '--fix']
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Releases

## Version 1.5.4

This release primarily focuses on improving the ESM components including fixes for serialization of parameter values, improvements for compiling bundles, and building custom layouts. Additionally this release includes the new `DatetimeSlider`, adds a copy button to codeblocks in `Markdown` panes, improves responsive sizing for Plotly and starts adding better support for Polars. Many thanks and a warm welcome to our new contributor @MP-MaximilianLattka as well as our maintainer team, including @Hoxbro, @thuydotm, @ahuang11, @MarcSkovMadsen and @philippjfr.

### Enhancements

- Add `DatetimeSlider` widget ([#7374](https://github.com/holoviz/panel/pull/7374))
- Improve Jupyter preview error handling ([#7434](https://github.com/holoviz/panel/pull/7434))
- Add copy button to `Markdown` codeblocks ([#7451](https://github.com/holoviz/panel/pull/7451))
- Various improvements for writing ESM components ([#7462](https://github.com/holoviz/panel/pull/7462))
- Log authorization callback errors ([#7463](https://github.com/holoviz/panel/pull/7463))
- Support polars in `pn.cache` ([#7472](https://github.com/holoviz/panel/pull/7472))
- Improve and document `hold` utility ([#7474](https://github.com/holoviz/panel/pull/7474))
- Improve how `panel compile` collects bundles ([#7477](https://github.com/holoviz/panel/pull/7477))

### Bug fixes

- Fix issues detecting changed property values during serialization ([#7432](https://github.com/holoviz/panel/pull/7432))
- Ensure ESM compilation correctly detects file extension ([#7446](https://github.com/holoviz/panel/pull/7446))
- Ensure parameter overrides are applied to ESM components ([#7452](https://github.com/holoviz/panel/pull/7452))
- Ensure component `Children` parameter correctly resolves when multiple types are defined ([#7454](https://github.com/holoviz/panel/pull/7454))
- Fix issues using Jupyter Preview with notifications enabled ([#7466](https://github.com/holoviz/panel/pull/7466))
- Ensure `HTML`/`Markdown` streaming does not freeze during rapid updates ([#7480](https://github.com/holoviz/panel/pull/7480))
- Ensure `Plotly` sizes correctly on initial render ([#7483](https://github.com/holoviz/panel/pull/7483))

## Version 1.5.3

This release fixes a number of smaller regressions related to `Tabulator` `row_content`, ensures `--dev`/`--autoreload` picks up on external modules correctly and resolves OAuth guest endpoints correctly. Additionally it introduces some enhancements and bug fixes for custom components, such as adding support for loading custom components ESM Javascript bundles from the inbuilt endpoint ensuring that the bundle can be cached by the browser. Many thanks and welcome to our new contributors @chryshumble and @haojungc, our returning contributors @TheoMathurin, @aktech and @Coderambling and the core maintainer team @Hoxbro, @ahuang11, @MarcSkovMadsen and @philippjfr for their contributions to this release.
Expand All @@ -20,6 +45,8 @@ This release fixes a number of smaller regressions related to `Tabulator` `row_c
- Prevent `Tabulator` from overlapping when `max_height` is set ([#7403](https://github.com/holoviz/panel/pull/7403))
- Do not mutate layout `Children` inplace ([#7417](https://github.com/holoviz/panel/pull/7403))
- Set `Tabulator` null formatter to empty string ([#7421](https://github.com/holoviz/panel/pull/7421))
- Ensure Tabulator table content does not overflow ([#7425](https://github.com/holoviz/panel/pull/7425))
- Ensure `cache` handles hashing of classes and instances correctly ([#7478](https://github.com/holoviz/panel/issues/7478))

### Compatibility

Expand Down
27 changes: 27 additions & 0 deletions doc/about/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

See [the HoloViz blog](https://blog.holoviz.org/#category=panel) for a visual summary of the major features added in each release.

## Version 1.5.4

This release primarily focuses on improving the ESM components including fixes for serialization of parameter values, improvements for compiling bundles, and building custom layouts. Additionally this release includes the new `DatetimeSlider`, adds a copy button to codeblocks in `Markdown` panes, improves responsive sizing for Plotly and starts adding better support for Polars. Many thanks and a warm welcome to our new contributor @MP-MaximilianLattka as well as our maintainer team, including @Hoxbro, @thuydotm, @ahuang11, @MarcSkovMadsen and @philippjfr.

### Enhancements

- Add `DatetimeSlider` widget ([#7374](https://github.com/holoviz/panel/pull/7374))
- Improve Jupyter preview error handling ([#7434](https://github.com/holoviz/panel/pull/7434))
- Add copy button to `Markdown` codeblocks ([#7451](https://github.com/holoviz/panel/pull/7451))
- Various improvements for writing ESM components ([#7462](https://github.com/holoviz/panel/pull/7462))
- Log authorization callback errors ([#7463](https://github.com/holoviz/panel/pull/7463))
- Support polars in `pn.cache` ([#7472](https://github.com/holoviz/panel/pull/7472))
- Improve and document `hold` utility ([#7474](https://github.com/holoviz/panel/pull/7474))
- Improve how `panel compile` collects bundles ([#7477](https://github.com/holoviz/panel/pull/7477))

### Bug fixes

- Fix issues detecting changed property values during serialization ([#7432](https://github.com/holoviz/panel/pull/7432))
- Ensure ESM compilation correctly detects file extension ([#7446](https://github.com/holoviz/panel/pull/7446))
- Ensure parameter overrides are applied to ESM components ([#7452](https://github.com/holoviz/panel/pull/7452))
- Ensure component `Children` parameter correctly resolves when multiple types are defined ([#7454](https://github.com/holoviz/panel/pull/7454))
- Fix issues using Jupyter Preview with notifications enabled ([#7466](https://github.com/holoviz/panel/pull/7466))
- Ensure `HTML`/`Markdown` streaming does not freeze during rapid updates ([#7480](https://github.com/holoviz/panel/pull/7480))
- Ensure `Plotly` sizes correctly on initial render ([#7483](https://github.com/holoviz/panel/pull/7483))

## Version 1.5.3

This release fixes a number of smaller regressions related to `Tabulator` `row_content`, ensures `--dev`/`--autoreload` picks up on external modules correctly and resolves OAuth guest endpoints correctly. Additionally it introduces some enhancements and bug fixes for custom components, such as adding support for loading custom components ESM Javascript bundles from the inbuilt endpoint ensuring that the bundle can be cached by the browser. Many thanks and welcome to our new contributors @chryshumble and @haojungc, our returning contributors @TheoMathurin, @aktech and @Coderambling and the core maintainer team @Hoxbro, @ahuang11, @MarcSkovMadsen and @philippjfr for their contributions to this release.
Expand All @@ -22,6 +47,8 @@ This release fixes a number of smaller regressions related to `Tabulator` `row_c
- Prevent `Tabulator` from overlapping when `max_height` is set ([#7403](https://github.com/holoviz/panel/pull/7403))
- Do not mutate layout `Children` inplace ([#7417](https://github.com/holoviz/panel/pull/7403))
- Set `Tabulator` null formatter to empty string ([#7421](https://github.com/holoviz/panel/pull/7421))
- Ensure Tabulator table content does not overflow ([#7425](https://github.com/holoviz/panel/pull/7425), [#7431](https://github.com/holoviz/panel/pull/7431))
- Ensure `cache` handles hashing of classes and instances correctly ([#7478](https://github.com/holoviz/panel/issues/7478))

### Compatibility

Expand Down
8 changes: 6 additions & 2 deletions doc/how_to/custom_components/esm/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ panel compile confetti
```

:::{hint}
`panel compile` accepts file paths, e.g. `my_components/custom.py`, and dotted module name, e.g. `my_package.custom`. If you provide a module name it must be importable.
`panel compile` accepts file paths, e.g. `my_components/custom.py`, or dotted module names, e.g. `my_package.custom`. If you provide a module name it must be importable.
:::

This will automatically discover the `ConfettiButton` but you can also explicitly request a single component by adding the class name:
Expand Down Expand Up @@ -216,7 +216,11 @@ esbuild output:
⚡ Done in 9ms
```

The compiled JavaScript file will be automatically loaded if it remains alongside the component. If you rename the component or modify its code or `_importmap`, you must recompile the component. For ongoing development, consider using the `--dev` option to ignore the compiled file and automatically reload the development version when it changes.
If the supplied module or package contains multiple components they will all be bundled together by default. If instead you want to generate bundles for each file explicitly you must list them with the `:` syntax, e.g. `panel compile package.module:Component1,Component2`. You may also provide a glob pattern to request multiple components to be built individually without listing them all out, e.g. `panel compile "package.module:Component*"`.

During runtime the compiled bundles will be resolved automatically, where bundles compiled for a specific component (i.e. `<component-name>.bundle.js`) take highest precedence and we then search for module bundles up to the root package, e.g. for a component that lives in `package.module` we first search for `package.module.bundle.js` in the same directory as the component and then recursively search in parent directories until we reach the root of the package.

If you rename the component or modify its code or `_importmap`, you must recompile the component. For ongoing development, consider using the `--dev` option to ignore the compiled file and automatically reload the development version when it changes.

#### Compilation Steps

Expand Down
2 changes: 1 addition & 1 deletion doc/how_to/custom_components/examples/table_viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This example demonstrates Panel's reactive programming paradigm using the Param
```{pyodide}
class ReactiveTables(Viewer):
dataset = param.ObjectSelector(default='iris', objects=['iris', 'autompg', 'population'])
dataset = param.Selector(default='iris', objects=['iris', 'autompg', 'population'])
rows = param.Integer(default=10, bounds=(0, 19))
Expand Down
12 changes: 8 additions & 4 deletions doc/how_to/deployment/pycafe.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# PY.CAFE Guide
# PyCafe Guide

This guide demonstrates how to deploy a Panel app on [PY.CAFE](https://py.cafe/).
This guide demonstrates how to deploy a Panel app on [py.cafe](https://py.cafe/).

PY.CAFE is a platform for creating and sharing data apps online, powered by [Pyodide](https://pyodide.org/). It offers a free tier for users.
PyCafe is a platform for creating and sharing data apps online, powered by [Pyodide](https://pyodide.org/). It offers a free tier for users. You can find the official PyCafe-Panel guide [here](https://py.cafe/docs/apps/panel).

## 1. Log In

Visit [PY.CAFE](https://py.cafe/) and either sign in or sign up for an account if you want to save your projects to your personal gallery.
Visit [py.cafe](https://py.cafe/) and either sign in or sign up for an account if you want to save your projects to your personal gallery.

## 2. Choose the Panel Framework

Expand Down Expand Up @@ -89,3 +89,7 @@ Explore the [`panel-org`](https://py.cafe/panel-org) gallery examples below:
- [Penguin Crossfilter](https://py.cafe/panel-org/penguin-crossfilter) from the [Penguin Crossfilter Tutorial](../../gallery/penguin_crossfilter)
- [Portfolio Analyzer](https://py.cafe/panel-org/portfolio-analyzer) from the [Portfolio Analyzer Tutorial](../../gallery/portfolio_analyzer).
- [VideoStream Interface](https://py.cafe/panel-org/videostream) from the [VideoStream Interface Tutorial](../../gallery/streaming_videostream).

----

For more examples check out [awesome-panel.org](https://py.cafe/awesome.panel.org).
4 changes: 2 additions & 2 deletions doc/how_to/param/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ We also define a ``view`` method that returns an HTML iframe displaying the coun
```{pyodide}
class GoogleMapViewer(param.Parameterized):
continent = param.ObjectSelector(default='Asia', objects=['Africa', 'Asia', 'Europe'])
continent = param.Selector(default='Asia', objects=['Africa', 'Asia', 'Europe'])
country = param.ObjectSelector(default='China', objects=['China', 'Thailand', 'Japan'])
country = param.Selector(default='China', objects=['China', 'Thailand', 'Japan'])
_countries = {'Africa': ['Ghana', 'Togo', 'South Africa', 'Tanzania'],
'Asia' : ['China', 'Thailand', 'Japan'],
Expand Down
2 changes: 1 addition & 1 deletion doc/how_to/param/examples/subobjects.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Having defined our basic domain model (of shapes in this case), we can now make
```{pyodide}
class ShapeViewer(param.Parameterized):
shape = param.ObjectSelector(default=shapes[0], objects=shapes)
shape = param.Selector(default=shapes[0], objects=shapes)
@param.depends('shape', 'shape.param')
def view(self):
Expand Down
2 changes: 1 addition & 1 deletion doc/how_to/param/subobjects.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ shapes = [NGon(), Circle()]
class ShapeViewer(param.Parameterized):
shape = param.ObjectSelector(default=shapes[0], objects=shapes)
shape = param.Selector(default=shapes[0], objects=shapes)
@param.depends('shape')
def view(self):
Expand Down
4 changes: 2 additions & 2 deletions doc/how_to/param/uis.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class Example(BaseClass):
date = param.Date(default=dt.datetime(2017, 1, 1),
bounds=(dt.datetime(2017, 1, 1), dt.datetime(2017, 2, 1)))
dataframe = param.DataFrame(default=pd.DataFrame({'A': [1, 2, 3]}))
select_string = param.ObjectSelector(default="yellow", objects=["red", "yellow", "green"])
select_fn = param.ObjectSelector(default=list,objects=[list, set, dict])
select_string = param.Selector(default="yellow", objects=["red", "yellow", "green"])
select_fn = param.Selector(default=list,objects=[list, set, dict])
int_list = param.ListSelector(default=[3, 5], objects=[1, 3, 5, 7, 9], precedence=0.5)
single_file = param.FileSelector(path='../../*/*.py*', precedence=0.5)
multiple_files = param.MultiFileSelector(path='../../*/*.py?', precedence=0.5)
Expand Down
72 changes: 72 additions & 0 deletions doc/how_to/performance/hold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Batching Updates with `hold`

When working with interactive dashboards and applications in Panel, you might encounter situations where updating multiple components simultaneously causes unnecessary re-renders. This is because Panel generally dispatches any change to a parameter immediately. This can lead to performance issues and a less responsive user experience because each individual update may trigger re-renders on the frontend. The `hold` utility in Panel allows you to batch updates to the frontend, reducing the number of re-renders and improving performance.

In this guide, we'll explore how to use `hold` both as a context manager and as a decorator to optimize your Panel applications.

## What is `hold`?

The `hold` function is a context manager and decorator that temporarily holds events on a Bokeh Document. When you update multiple components within a `hold` block, the events are collected and dispatched all at once when the block exits. This means that the frontend will only re-render once, regardless of how many updates were made, leading to a smoother and more efficient user experience.

Let’s try first **without `hold`** to understand the difference `hold` can make:

```{pyodide}
import panel as pn
from panel.io import hold
def increment(e):
for obj in column_0:
obj.object = str(e.new)
column_0 = pn.FlexBox(*['0']*100)
button = pn.widgets.Button(name='Increment', on_click=increment)
pn.Column(column_0, button).servable()
```

## Using `hold`

### As a Decorator

If you have a function that updates components and you want to ensure that all updates are held, you can use `hold` as a decorator. For example, here we update 100 components at once. If you do not use `hold`, each of these events is sent and applied in series, potentially resulting in visible updates.

```{pyodide}
import panel as pn
from panel.io import hold
@hold()
def increment(e):
for obj in column_1:
obj.object = str(e.new)
column_1 = pn.FlexBox(*['0']*100)
button = pn.widgets.Button(name='Increment', on_click=increment)
pn.Column(column_1, button).servable()
```

Applying the `hold` decorator means all the updates are sent in a single WebSocket message and applied on the frontend simultaneously.

### As a Context Manager

Alternatively, the `hold` function can be used as a context manager, potentially giving you finer-grained control over which events are batched and which are not:

```{pyodide}
import time
import panel as pn
from panel.io import hold
def increment(e):
with button.param.update(name='Incrementing...', disabled=True):
with hold():
for obj in column_2:
obj.object = str(e.new)
column_2 = pn.FlexBox(*['0']*100)
button = pn.widgets.Button(name='Increment', on_click=increment)
pn.Column(column_2, button).servable()
```

Here the updates to the `Button` are dispatched immediately, while the updates to the counters are batched.
8 changes: 8 additions & 0 deletions doc/how_to/performance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ Discover how to reuse sessions to improve the start render time.
Discover how to enable throttling to reduce the number of events being processed.
:::

:::{grid-item-card} {octicon}`tab;2.5em;sd-mr-1 sd-animate-grow50` Batching Updates with `hold`
:link: hold
:link-type: doc

Discover how to improve performance by using the `hold` context manager and decorator to batch updates to multiple components.
:::

::::

```{toctree}
Expand All @@ -28,4 +35,5 @@ Discover how to enable throttling to reduce the number of events being processed
reuse_sessions
throttling
hold
```
6 changes: 3 additions & 3 deletions doc/how_to/styling/altair.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ from vega_datasets import data
pn.extension("vega")
def plot(theme, color):
alt.themes.enable(theme)
alt.theme.enable(theme)
return (
alt.Chart(data.cars())
Expand All @@ -41,7 +41,7 @@ def plot(theme, color):
.interactive()
)
themes = sorted(alt.themes.names())
themes = sorted(alt.theme.names())
theme = pn.widgets.Select(value="dark", options=themes, name="Theme")
color = pn.widgets.ColorPicker(value="#F08080", name="Color")
Expand All @@ -53,5 +53,5 @@ pn.Column(
).servable()
```

Please note that the line `alt.themes.enable(theme)` will set the theme of all future generated plots
Please note that the line `alt.theme.enable(theme)` will set the theme of all future generated plots
unless you specifically change it before usage in a `Vega` pane.
Loading

0 comments on commit fea45f0

Please sign in to comment.