Status#

Use progress bars or spinners to visualize loading status in your notebooks and apps. Useful when iterating over collections or loading data from files, databases, or APIs.

Progress bar#

You can display a progress bar while iterating over a collection, similar to tqdm.

marimo.status.progress_bar(collection: Collection[S | int], *, title: str | None = None, subtitle: str | None = None, completion_title: str | None = None, completion_subtitle: str | None = None, show_rate: bool = True, show_eta: bool = True) Iterable[S | int]#

Iterate over a collection and show a progress bar

Example.

for i in mo.status.progress_bar(range(10)):
    ...

You can optionally provide a title and subtitle to show during iteration, and a title/subtitle to show upon completion.

Args.

  • collection: a collection to iterate over

  • title: optional title

  • subtitle: optional subtitle

  • completion_title: optional title to show during completion

  • completion_subtitle: optional subtitle to show during completion

  • show_rate: if True, show the rate of progress (items per second)

  • show_eta: if True, show the estimated time of completion

Returns.

An iterable object that wraps collection

Spinner#

marimo.status.spinner(title: str | None = None, subtitle: str | None = None, remove_on_exit: bool = True) Iterator[Spinner]#

Show a loading spinner

Use mo.status.spinner() as a context manager to show a loading spinner. You can optionally pass a title and subtitle.

Example.

with mo.status.spinner(subtitle="Loading data ...") as _spinner:
    data = expensive_function()
    _spinner.update(subtitle="Crunching numbers ...")
    ...

mo.ui.table(data)

Args:

  • title: optional title

  • subtitle: optional subtitle

  • remove_on_exit: if True, the spinner is removed from output on exit