Skip to content

Commit

Permalink
Auto-detect VSCode and Colab comms (#2536)
Browse files Browse the repository at this point in the history
* Auto-detect VSCode and Colab comms

* Fix flake
  • Loading branch information
philippjfr authored Jul 15, 2021
1 parent 865fabe commit 4473ab2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions panel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,20 @@ def __call__(self, *args, **params):
load_notebook(config.inline)
panel_extension._loaded = True

if 'comms' in params:
return

# Try to detect environment so that we can enable comms
try:
import google.colab # noqa
config.comms = "colab"
return
except ImportError:
pass

# Check if we're running in VSCode
if "VSCODE_PID" in os.environ:
config.comms = "vscode"

def _apply_signatures(self):
from inspect import Parameter, Signature
Expand Down

0 comments on commit 4473ab2

Please sign in to comment.