Exclude Databricks from notebook env only if the runtime is below 11.0 (#17988)

* Exclude Databricks from notebook env only if the runtime is below 11.0

* Dummy commit to trigger CI

* Empty commit to trigger CI

* Empty commit to trigger CI

* Empty commit to trigger CI

* Empty commit to trigger CI

* Empty commit to trigger CI

* Empty commit to trigger CI

* Empty commit to trigger CI
This commit is contained in:
David Heryanto 2022-07-02 04:17:40 +08:00 committed by GitHub
parent 6890d1960f
commit 49c8c67fb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -506,7 +506,9 @@ def is_in_notebook():
raise ImportError("console")
if "VSCODE_PID" in os.environ:
raise ImportError("vscode")
if "DATABRICKS_RUNTIME_VERSION" in os.environ:
if "DATABRICKS_RUNTIME_VERSION" in os.environ and os.environ["DATABRICKS_RUNTIME_VERSION"] < "11.0":
# Databricks Runtime 11.0 and above uses IPython kernel by default so it should be compatible with Jupyter notebook
# https://docs.microsoft.com/en-us/azure/databricks/notebooks/ipython-kernel
raise ImportError("databricks")
return importlib.util.find_spec("IPython") is not None