Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detection of old Bokeh in notebook load script #7269

Merged
merged 2 commits into from
Sep 13, 2024
Merged

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Sep 13, 2024

The notebook load script was designed to detect old versions of Bokeh (and Panel) and potentially run multiple copies of the libraries side-by-side. It did this by comparing the global Bokeh object version, if already defined, to the new version being loaded. However it seems like scoping rules meant that in some cases it was comparing a local Bokeh variable rather than the global window.Bokeh object, which meant that it would incorrectly detect that Bokeh should be replaced, but then later correctly detect that it doesn't actually have to reload Bokeh. This meant that it would unload Bokeh and then not reload it.

Additionally I've found that due to escaping rules meant that special characters (such as ^) in URLs would be escaped so that some of the checks that tried to ensure libraries weren't loaded twice were not detecting this correctly because they compared escaped with non-escaped URIs. We now escape them using the escapeURI function before comparing.

Fixes #7264

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.18%. Comparing base (b00840c) to head (d0ffffd).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7269   +/-   ##
=======================================
  Coverage   82.18%   82.18%           
=======================================
  Files         337      337           
  Lines       50359    50359           
=======================================
+ Hits        41387    41389    +2     
+ Misses       8972     8970    -2     

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

@hoxbro
Copy link
Member

hoxbro commented Sep 13, 2024

I'm very happy with this PR.

@philippjfr philippjfr merged commit 7aeebd3 into main Sep 13, 2024
16 checks passed
@philippjfr philippjfr deleted the reload_bokeh_issue branch September 13, 2024 10:12
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.

Bokeh: BokehJS was loaded multiple times but one version failed to initialize.
2 participants