Skip to content

Commit

Permalink
fix: detect in google colab
Browse files Browse the repository at this point in the history
  • Loading branch information
islxyqwe committed Dec 2, 2024
1 parent 8c1194d commit 3566bce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pygwalker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pygwalker.services.global_var import GlobalVarManager
from pygwalker.services.kaggle import show_tips_user_kaggle as __show_tips_user_kaggle

__version__ = "0.4.9.14a0"
__version__ = "0.4.9.14a1"
__hash__ = __rand_str()

from pygwalker.adapter.walk import walk
Expand Down
5 changes: 4 additions & 1 deletion pygwalker/adapter/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
def is_notebook() -> bool:
try:
shell = get_ipython().__class__.__name__
ipython = get_ipython()
shell = ipython.__class__.__name__
if shell == 'ZMQInteractiveShell':
return True # Jupyter notebook or qtconsole
elif shell == 'TerminalInteractiveShell':
return False # Terminal running IPython
else:
if 'google.colab' in str(ipython):
return True # in Google colab
return False # Other type (?)
except NameError:
return False # Probably standard Python interpreter
Expand Down

0 comments on commit 3566bce

Please sign in to comment.