Fix detection of old Bokeh in notebook load script #7269
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 localBokeh
variable rather than the globalwindow.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 theescapeURI
function before comparing.Fixes #7264