Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

feat: progress_bar can be removed on exit (#2192)

Andrea Di Gioacchino8ba43db9b2b4
diff --git a/marimo/_plugins/stateless/status/_progress.py b/marimo/_plugins/stateless/status/_progress.py
index 81a9a37122..7cff23d1e8 100644
--- a/marimo/_plugins/stateless/status/_progress.py
+++ b/marimo/_plugins/stateless/status/_progress.py
@@ -302,6 +302,7 @@ class progress_bar:
- `total`: optional total number of items to iterate over
- `show_rate`: if True, show the rate of progress (items per second)
- `show_eta`: if True, show the estimated time of completion
+ - `remove_on_exit`: if True, remove the progress bar from output on exit
"""
def __init__(
@@ -315,9 +316,11 @@ class progress_bar:
total: Optional[int] = None,
show_rate: bool = True,
show_eta: bool = True,
+ remove_on_exit: bool = False,
):
self.completion_title = completion_title
self.completion_subtitle = completion_subtitle
+ self.remove_on_exit = remove_on_exit
if collection is not None:
self.collection = collection
@@ -365,4 +368,6 @@ class progress_bar:
title=self.completion_title,
subtitle=self.completion_subtitle,
)
+ if self.remove_on_exit:
+ self.progress.clear()
self.progress.close()