Improve detection of comms in vscode and colab #4115
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.
Fixes #3767
Before this PR if
hv.extension
was called beforepn.extension
it will be setpn.config.comms
to"default"
and notvscode
in vs code orcolab
in Google Colab.This PR refactors the detection into its own method and always calls in a notebook. On the first run, it will auto-detect the comms and replace
None
with one ofdefault
,ipywidgets
,vscode
, orcolab
. Then in the following calls, it will only change thecomms
if it is explicitly set.I'm unsure if the order of
pyodide
andvscode
should be swapped.