marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
6.3k stars 204 forks source link

`alert` arg for `marimo.status.progress_bar` #2364

Open metaboulie opened 2 hours ago

metaboulie commented 2 hours ago

Description

Add an alert arg to marimo.status.progress_bar, alert completion message when progress is completed


Besides,

A tiny doc issue here

in the Args part, add description for disabled


why this is valuable:

If I'm training a neural network and editing some other parts of the notebook, I'd like a notification when the training is done

metaboulie commented 2 hours ago

I can implement this and fix the doc error if it's valuable

mscolnick commented 2 hours ago

i like this idea. @metaboulie, maybe for better composition, what about an mo.toast()? then you can place the alert after spinner too or before the progress. we also also had more arguments like title/description

metaboulie commented 1 hour ago

Do you mean something like:

for _ in mo.status.progress_bar(range(100)):
    await asyncio.sleep(0.5)
mo.toast("Finished.")
mscolnick commented 1 hour ago

yep i think that would be great.

we already have an Alert operation we could use:

def toast(title):
   Alert(title=title).broadcast()

I think the solution should be only a few lines of code

metaboulie commented 1 hour ago

Should we put it inside Control flow or Status?

mscolnick commented 1 hour ago

oh status is good - maybe mo.status.toast()