Misc#
Control flow#
Use mo.stop to halt execution of a cell, and optionally output an object.
This function is useful for validating user input.
- marimo.stop(predicate: bool, output: object | None = None) None#
Stops execution of a cell when
predicateisFalseWhen
predicateisTrue, this function raises aMarimoStopError. If uncaught, this exception stops execution of the current cell and makesoutputits output. Any descendants of this cell that were previously scheduled to run will not be run, and their defs will be removed from program memory.Example:
mo.stop(form.value is None, mo.md("**Submit the form to continue.**"))
Raises:
When
predicateisTrue, raises aMarimoStopError.
- class marimo.MarimoStopError(output: object | None)#
Raised by
marimo.stopto stop execution of a cell and descendants.
Debugging#
Use mo.defs and mo.refs to get the global definitions and references of
a cell.
- marimo.defs() tuple[str, ...]#
Get the definitions of the currently executing cell.
Returns:
tuple of the currently executing cell’s defs.
- marimo.refs() tuple[str, ...]#
Get the references of the currently executing cell.
Returns:
tuple of the currently executing cell’s refs.