Skip to content

Auto-run, pre-rendering, and PanelLive server component#26

Merged
MarcSkovMadsen merged 8 commits intomainfrom
enhancement/pre-rendering
Feb 21, 2026
Merged

Auto-run, pre-rendering, and PanelLive server component#26
MarcSkovMadsen merged 8 commits intomainfrom
enhancement/pre-rendering

Conversation

@MarcSkovMadsen
Copy link
Contributor

@MarcSkovMadsen MarcSkovMadsen commented Feb 21, 2026

PR: Auto-run, pre-rendering, and PanelLive server component

Summary

This PR adds three major features: click-to-run with pre-rendering, a PanelLive JSComponent for Panel server apps, and bundled in-package assets for pip installs.

What changed

Auto-run and pre-rendering

  • auto-run="false" is now the default in MkDocs fences -- examples require a click to activate Pyodide
  • PanelLive.runAll() API for sequential execution of all <panel-live> elements on a page
  • Pre-rendering: build-time execution of Panel code produces static Bokeh JSON shown as a preview until Pyodide loads
  • panel-live pre-render CLI command for build-time rendering
  • preview attribute for static image placeholders (PNG/GIF) with "Run" badge overlay
  • Content-hash caching in .panel-live/ to avoid redundant re-renders
  • Sphinx directive and Quarto Lua filter support for pre-rendering

PanelLive server component

  • PanelLive JSComponent wrapping <panel-live> for use in panel serve apps
  • 6 modes: editor, app, playground, headless, progress, debug
  • evaluate() -- execute Python in the browser and return the result to the server
  • run() -- trigger the full render pipeline programmatically from the server
  • input param -- server-to-client reactive data push (no re-run needed)
  • output param -- client-to-server data via server.output
  • send() -- push arbitrary JSON data to client-side code
  • Progress mode: spinning Python icon with CSS tooltip showing queue depth
  • Shadow DOM workarounds (getElementById patch, CSS mirroring) for Bokeh compatibility
  • ESM module with bidirectional messaging bridge

CLI and packaging

  • panel-live serve command serves the showcase app with auto-discovered assets
  • Asset discovery: dist/ (repo dev) -> static/ (pip install) -> CDN fallback
  • JS/CSS bundled in src/panel_live/static/ -- pip install panel-live works out of the box
  • pixi run serve-showcase task chains build-js + serve for always-fresh dev workflow
  • pixi run sync-static task copies built assets into the package for wheel builds

Showcase app

  • 11-section demo: all 6 modes, server RPC (evaluate/run), reactive push, periodic push, client-to-server data
  • Branded logo bar (Panel + Pyodide) with documentation links
  • Playwright smoke test (tests/ui/test_showcase.py)

Web component improvements

  • Element registry with registerElement()/unregisterElement() for document-order tracking
  • <panel-live-config> element for declarative configuration
  • Worker stall detection and crash recovery (45s timeout, 1 retry)
  • JSPI disabled by default (fixes Chrome 137+ STATUS_ACCESS_VIOLATION crashes)
  • Dark/light theme improvements in the editor and tooltip

CI fix

  • Added permissions: contents: write to pre_commit job for PNG optimization auto-commit

Files changed

97 files, +11609 / -2386 lines across:

  • src/panel_live/ -- Python package (component, CLI, ESM, pre-render, fences, sphinx)
  • lib/ -- JS source modules (registry, config-element, theme, worker-bridge, panel-live-element)
  • tests/ -- 178 Python tests, 178 JS tests, Playwright smoke test
  • docs/ -- updated how-to guides, tutorials, examples, open/closed issues
  • docs-sphinx/, docs-quarto/ -- extension test sites updated
  • quarto/_extensions/ -- Lua filter and bundled assets updated
  • .github/workflows/ci.yml -- permissions fix

Testing

  • pixi run test -- 178 passed, 4 skipped
  • pixi run test-js -- 178 passed (12 test files)
  • pixi run lint -- all checks passed
  • Team review (6 agents) found and fixed 3 bugs: tooltip style injection singleton, CLI empty-dir edge case, stale static assets

MarcSkovMadsen and others added 8 commits February 21, 2026 07:46
…e Accordion layout

- Add `input` param to PanelLive server component — setting `widget.input = data`
  pushes to client's `server.input` (replaces `widget.send()` as primary API)
- Add `output` param to client-side `_ServerData` class — setting `server.output`
  in Pyodide sends data back to server's `output` param
- Rename client namespace injection from `server_data` to `server`
- Rename `_ServerData.value` to `_ServerData.input` for consistency
- Rewrite showcase: centered Accordion layout (width=800), 10 sections including
  reactive push (s8), periodic push (s9), and client→server (s10)
- Update tutorials and how-to docs to use `widget.input =` and `server.output`
- Add tests for input param, input→send wiring, and showcase API usage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MarcSkovMadsen MarcSkovMadsen merged commit 444f2f7 into main Feb 21, 2026
7 checks passed
@MarcSkovMadsen MarcSkovMadsen changed the title auto-run, pre-rendering Auto-run, pre-rendering, and PanelLive server component Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant