Skip to content

Commit

Permalink
fix: is_notebook returns false for google colab
Browse files Browse the repository at this point in the history
  • Loading branch information
dakshpokar committed Dec 18, 2024
1 parent 229a3ac commit a2f1148
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion maidr/util/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def is_notebook() -> bool:
try:
from IPython import get_ipython # type: ignore

return get_ipython() is not None and "ipykernel" in str(get_ipython())
return get_ipython() is not None and (
"ipykernel" in str(get_ipython())
or "google.colab" in str(get_ipython())
)
except ImportError:
return False

Expand Down

0 comments on commit a2f1148

Please sign in to comment.