mirror of https://github.com/Textualize/rich.git
Detect Databricks notebook as Jupyter environment
This commit is contained in:
parent
2ee992b17e
commit
3a5f09743a
|
@ -516,7 +516,11 @@ def _is_jupyter() -> bool: # pragma: no cover
|
|||
return False
|
||||
ipython = get_ipython() # type: ignore[name-defined]
|
||||
shell = ipython.__class__.__name__
|
||||
if "google.colab" in str(ipython.__class__) or shell == "ZMQInteractiveShell":
|
||||
if (
|
||||
"google.colab" in str(ipython.__class__)
|
||||
or os.getenv("DATABRICKS_ROOT_VIRTUALENV_ENV")
|
||||
or shell == "ZMQInteractiveShell"
|
||||
):
|
||||
return True # Jupyter notebook or qtconsole
|
||||
elif shell == "TerminalInteractiveShell":
|
||||
return False # Terminal running IPython
|
||||
|
|
Loading…
Reference in New Issue