Dynamic figure problem with Bokeh v 3.4.0 udgrade

I’m a developer on a project that uses bokeh in an interactive report. I corrected a crash that was due to a change in v3.4.0, but an element of interactive functionality has stopped working correctly with v3.4.0, but still works on the same data/code with v3.3.4.

You can see an example of our interactive report at: tedana report
If you click on any wedge of the pie chart or dot on the scatter plot, other plots and images appear to the right. When you click on another wedge, the other plots automatically update.

When the same code was run with v3.4.0, I can click on one wedge and the other plots updates, but if I click on additional wedges, multiple wedges are highlighted and the other plots don’t update. I can re-click on wedges so that they are no longer highlighted and the other plots update when there is one and only one wedge highlighted.

Here is an example pie chart with v3.4.0. It should not be possible to have 3 wedges highlighted at the same time.

A PR with the code I’m working on is here: Fix dynamic reports with bokeh 3.4.0 problem by handwerkerd · Pull Request #1068 · ME-ICA/tedana · GitHub

Is there anything specific to the v3.4.0 release that could have affected this functionality?

Thank you for any guidance you can provide.

@handwerkerd It could be a usage issue or a bug or something else. it’s not possible to speculate about anything at all without a complete Minimal Reproducible Example that can actually be investigated directly.

1 Like

This isn’t quite minimal since you’ll need to install tedana and run the full pipeline (<3 minutes), but it is complete. The relevant bokeh-using functions are are in: tedana/tedana/reporting at fix-bokeh3.4.0 · handwerkerd/tedana · GitHub

It will be a bit more work to upload and share data that make makes it possible to run just the bokeh part, but, if the following isn’t enough and someone is interested in looking into this more, I’ll do it.

The following code can be run twice, once with each bokeh v3.3.4 and again with v3.4.0. You might want to change out_dir so that the results can be directly compared. The interactive report that uses bokeh will be at local_data_location/out_dir/tedana_report.html

# IN SHELL
# Download tedana and install within your environment
git clone [email protected]:handwerkerd/tedana.git
git checkout fix-bokeh3.4.0
pip install -e .'[all]'

# IN PYTHON
import os

from tedana.io import InputHarvester
from tedana.workflows import tedana as tedana_cli
from tedana.tests import test_integration


# Path to the directory where you want data downloaded and processed
local_data_location='./'

# You might want to change this output directory path name for each version of bokeh run.
out_dir = os.path.abspath(os.path.join(local_data_location, "./three-echo-bokeh3.4"))

# This will download data to run within tedana
test_integration.download_test_data("rqhfc", local_data_location)


tedana_cli.tedana_workflow(
        data=f"{local_data_location}/three_echo_Cornell_zcat.nii.gz",
        tes=[14.5, 38.5, 62.5],
        out_dir=out_dir,
        low_mem=True,
        tedpca=30,
    )

I definitely don’t have bandwidth to pore over an entire project. If you can work up an actual MRE I am happy to take a look.

1 Like

I decided to look more carefully through all the PRs merged for v3.4.0. The one that stands out to me is Add support for xor selection and inversion by mattpap · Pull Request #13545 · bokeh/bokeh · GitHub It changed the default response for taps and the new behavior I’m seeing is vaguely similar to the new default. That is I now need to tap an element a second time to deselect it before clicking on a new element.

Within the bokeh v.3.40 API, is there a way to explicitly apply the previous default so that I can confirm whether or not this is the cause of our issue?

That’s a question for @mateusz The best way to reach him is to open a GitHub development discussion

1 Like

In case anyone else comes across this thread, my solution, as also documented in Clarifying API for selection modes for Taps · bokeh/bokeh · Discussion #13797 · GitHub was to define model.Taptools with the mode='replace' option. This PR that shows how I fixed this for my project: Fix dynamic reports with bokeh 3.4.0 problems by handwerkerd · Pull Request #1068 · ME-ICA/tedana · GitHub