Skip to content

docs: import panel in Flask + Bokeh deployment example#6881

Merged
hoxbro merged 1 commit into
holoviz:mainfrom
mvanhorn:fix/docs-deploy-flask-import-panel
May 12, 2026
Merged

docs: import panel in Flask + Bokeh deployment example#6881
hoxbro merged 1 commit into
holoviz:mainfrom
mvanhorn:fix/docs-deploy-flask-import-panel

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Description

The Combining Bokeh Application and Flask Application example in the Deploying Bokeh Apps user guide gives a runnable flaskApp.py that fails the moment Panel renders a HoloViews DynamicMap:

bokeh.core.serialization.DeserializationError: can't resolve type 'panel.models.browser.BrowserInfo'

pn.serve(...) adds Panel-specific models (e.g. panel.models.browser.BrowserInfo) to the document, but flaskApp.py only imports from bokeh.client / bokeh.embed / flask, so when pull_session(...) deserializes the session those types aren't registered with bokeh and the request 500s.

In #6041 philippjfr identified two fixes, including that "the HoloViews docs should be updated to include import panel." Importing panel registers its bokeh model classes so pull_session / server_session can deserialize them on the Flask side. This PR adds that single import panel line to the flaskApp.py block in examples/user_guide/Deploying_Bokeh_Apps.ipynb, with a short comment explaining why the import is there even though the symbol isn't otherwise referenced (so a linter or a curious reader doesn't strip it).

Fixes #6041

How Has This Been Tested?

This is a single import-line addition to a Python code block inside a markdown cell of a .ipynb that the docs build skips (:skip_execute: True in doc/user_guide/Deploying_Bokeh_Apps.rst), so the change has no runtime effect on nbsite/Sphinx output beyond rendering the extra line. I verified:

  • python -c "import json; json.load(open('examples/user_guide/Deploying_Bokeh_Apps.ipynb'))" still parses the notebook cleanly.
  • The diff is a 2-line insert inside the flaskApp.py markdown code block and does not touch any other cell, executed code, or metadata.

I did not stand up the full Flask + Bokeh + Panel stack locally to re-run the original repro; the maintainer comment on #6041 already established that import panel is the docs-side fix. If you'd prefer the docs to also include import panel.models.browser (the full workaround philippjfr suggested for users hitting the error today), happy to add it in a fixup commit.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested all AI-generated content in my PR.
    • I take responsibility for all AI-generated content in my PR.

Tools and Models: Claude Code + Opus 4.7. Used to draft the one-line docs change and this PR body; I reviewed the diff and the notebook JSON before pushing.

Checklist

  • Pull request title follows the conventional format
  • Added documentation

The Combining Bokeh Application and Flask Application example failed
with `bokeh.core.serialization.DeserializationError: can't resolve type
'panel.models.browser.BrowserInfo'` because `panel.models.browser`
isn't loaded by the bokeh imports in flaskApp.py and so the panel-
created session can't be deserialized by `pull_session`.

philippjfr noted in holoviz#6041 that the docs example should include
`import panel`, which loads the panel models with bokeh so they
resolve during deserialization.

Fixes holoviz#6041
@codecov

codecov Bot commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.22%. Comparing base (4fbc71e) to head (a90bbc3).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6881   +/-   ##
=======================================
  Coverage   89.22%   89.22%           
=======================================
  Files         340      340           
  Lines       73969    73969           
=======================================
  Hits        65999    65999           
  Misses       7970     7970           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hoxbro

hoxbro commented May 12, 2026

Copy link
Copy Markdown
Member

Thank you for the PR

@hoxbro
hoxbro merged commit 948ee3c into holoviz:main May 12, 2026
18 checks passed
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.

DeserializationError when trying out Deploying_Bokeh_Apps examples

2 participants