module documentation

Context utilities.

Copyright 2017-2025, Voxel51, Inc.

Exception ContextError Exception raised when an action is taken in an unsupported context.
Function get_url Undocumented
Function init_context Initializes context settings.
Function is_colab_context Determines whether this process is running in Google Colab.
Function is_databricks_context Determines whether this process is running in Databricks.
Function is_jupyter_context Determines whether this process is running in a Jupyter notebook.
Function is_notebook_context Determines whether this process is running in a notebook context, either Jupyter or Google Colab.
Function _get_context Determine the most specific context that we're in.
Function _get_databricks_proxy Undocumented
Function _get_databricks_proxy_url Undocumented
Function _requires_http_polling Undocumented
Function _set_databricks Undocumented
Constant _COLAB Undocumented
Constant _DATABRICKS Undocumented
Constant _DATABRICKS_HOST Undocumented
Constant _DATABRICKS_PROXY Undocumented
Constant _IPYTHON Undocumented
Constant _NONE Undocumented
Variable _context Undocumented
def get_url(address: str, port: int, proxy_url: str = None, **kwargs: dict[str, str]) -> str: (source)

Undocumented

def init_context(): (source)

Initializes context settings.

def is_colab_context(): (source)

Determines whether this process is running in Google Colab.

Returns
True/False
def is_databricks_context(): (source)

Determines whether this process is running in Databricks.

Returns
True/False
def is_jupyter_context(): (source)

Determines whether this process is running in a Jupyter notebook.

Returns
True/False
def is_notebook_context(): (source)

Determines whether this process is running in a notebook context, either Jupyter or Google Colab.

Returns
True/False
def _get_context(): (source)

Determine the most specific context that we're in.

Returns
one of
  • _COLAB: we're in Colab with an IPython notebook context
  • _DATABRICKS: we're in Databricks with an IPython notebook context
  • _IPYTHON: we're in an IPython notebook context (e.g., from running jupyter notebook at the command line)
  • _NONE: we're in a non-notebook context, e.g., a Python script or a Python REPL
def _get_databricks_proxy(port: int): (source)

Undocumented

def _get_databricks_proxy_url(port: int): (source)

Undocumented

def _requires_http_polling(): (source)

Undocumented

def _set_databricks() -> str: (source)

Undocumented

Undocumented

Value
'COLAB'
_DATABRICKS: str = (source)

Undocumented

Value
'DATABRICKS'
_DATABRICKS_HOST = (source)

Undocumented

Value
None
_DATABRICKS_PROXY = (source)

Undocumented

Value
None
_IPYTHON: str = (source)

Undocumented

Value
'IPYTHON'

Undocumented

Value
'NONE'
_context = (source)

Undocumented