You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When in Jupyter lab, if I call independent instances of a Progress(), for example by mapping a function that invokes a Progress() through an iterable, the context manager overwrites/deletes previous instances along the iteration.
For example (inside a Jupyter Lab notebook) inspired from code in the tutorial:
import time
from rich.progress import Progress
def run_snippet(iteration):
with Progress() as progress:
task1 = progress.add_task("[red]Downloading...", total=5)
while not progress.finished:
progress.update(task1, advance=0.5)
#progress.log(f'this iteration {iteration}') <- uncomment for "in-context" effect
time.sleep(0.2)
list(map(run_snippet, range(10)))
The code above will overwrite any print-out (or anything else like plots or rich.renderables) from previous iterations … even within the same context (for example by un-commenting the .log() line ). This behavior doesn't happen when executed from a console. There, anything that is printed or rendered, remains visible and piles up.
My ignorant guess is that when the next Process() context is invoked, the way jupyter handles it by just throwing clearing away what was displayed in the past and moves forward.
Is there a way to prevent his?
And finally, thanks so much for this wonderful tool!
(Edited some words for clarity.)
(Edit2: updated to specify that case has been tested only on Jupyter lab instead of Jupyter notebook)
The text was updated successfully, but these errors were encountered:
Jupyter lab and Jupyter notebook behave differently doing this, and we're not sure what the correct behaviour should be. We suspect a bug in one or the other.
When in Jupyter lab, if I call independent instances of a
Progress()
, for example by mapping a function that invokes aProgress()
through an iterable, the context manager overwrites/deletes previous instances along the iteration.For example (inside a Jupyter Lab notebook) inspired from code in the tutorial:
The code above will overwrite any print-out (or anything else like plots or rich.renderables) from previous iterations … even within the same context (for example by un-commenting the
.log()
line ). This behavior doesn't happen when executed from a console. There, anything that is printed or rendered, remains visible and piles up.My ignorant guess is that when the next
Process()
context is invoked, the way jupyter handles it by just throwing clearing away what was displayed in the past and moves forward.Is there a way to prevent his?
And finally, thanks so much for this wonderful tool!
(Edited some words for clarity.)
(Edit2: updated to specify that case has been tested only on Jupyter lab instead of Jupyter notebook)
The text was updated successfully, but these errors were encountered: