Skip to content

Bokeh 4 removed bokeh.io.state - #12721

Merged
crusaderky merged 2 commits into
dask:mainfrom
crusaderky:fix/bokeh-state-import
Nov 13, 2026
Merged

crusaderky merged 2 commits into
dask:mainfrom
crusaderky:fix/bokeh-state-import

Conversation

@crusaderky

@crusaderky crusaderky commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Bokeh 4.0 removed the module-level state object from bokeh.io, so every call to
Profiler.visualize() raises:

ImportError: cannot import name 'state' from 'bokeh.io'

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

     29 files  ± 0       29 suites  ±0   6h 52m 42s ⏱️ + 12m 25s
 19 930 tests + 1   18 501 ✅ + 1   1 429 💤 ± 0  0 ❌ ±0 
436 286 runs  +28  384 816 ✅ +15  51 470 💤 +13  0 ❌ ±0 

Results for commit 1fe8259. ± Comparison against base commit 025d6ac.

♻️ This comment has been updated with latest results.

@crusaderky crusaderky changed the title [unsupervised AI] Fix bokeh 4 import of curstate in profile visualization Fix bokeh 4 import of curstate Nov 13, 2026
@crusaderky
crusaderky force-pushed the fix/bokeh-state-import branch from 15ec578 to ec1e4ff Compare November 13, 2026 14:02
Bokeh 4 removed both ``bokeh.io.state`` and ``bokeh.io.output_file()``,
along with the global output state they exposed. Importing ``curstate``
from ``bokeh.io.state`` therefore raised ModuleNotFoundError on every
``Profiler.visualize()`` call, and saving a plot would still have raised
AttributeError afterwards.

Detect notebook mode through ``bokeh.io.notebook.notebook_environment()``
and pass the destination filename and the resource mode straight to
``save()`` on Bokeh 4+, while keeping the ``output_file()`` + ``save()``
sequence on Bokeh 3, where calling ``save()`` without a configured
``output_file()`` emits a UserWarning (an error under dask's test suite).
Add a test for the notebook-aware ``save`` default.
@crusaderky
crusaderky marked this pull request as ready for review November 13, 2026 15:23
@crusaderky crusaderky changed the title Fix bokeh 4 import of curstate Bokeh 4 removed bokeh.io.state Nov 13, 2026
@crusaderky
crusaderky merged commit fb29545 into dask:main Nov 13, 2026
36 of 38 checks passed
@crusaderky
crusaderky deleted the fix/bokeh-state-import branch November 13, 2026 15:24
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