apache_beam.utils.interactive_utils module

Common interactive utility module.


Determines if current code is executed within an ipython session.


Determines if current code is executed from an ipython notebook.

If is_in_notebook() is True, then is_in_ipython() must also be True.

apache_beam.utils.interactive_utils.alter_label_if_ipython(transform, pvalueish)[source]

Alters the label to an interactive label with ipython prompt metadata prefixed for the given transform if the given pvalueish belongs to a user-defined pipeline and current code execution is within an ipython kernel. Otherwise, noop.

A label is either a user-defined or auto-generated str name of a PTransform that is unique within a pipeline. If current environment is_in_ipython(), Beam can implicitly create interactive labels to replace labels of top-level PTransforms to be applied. The label is formatted as: Cell {prompt}: {original_label}.