From 82b7eeccd78d75d776fc7aae2345e01d6aebaa26 Mon Sep 17 00:00:00 2001 From: Ben Denham Date: Mon, 20 May 2024 20:10:21 +1200 Subject: [PATCH] Set dynamic_ncols=True to improve layout of tqdm progress bars --- labtech/lab.py | 1 + labtech/monitor.py | 1 + 2 files changed, 2 insertions(+) diff --git a/labtech/lab.py b/labtech/lab.py index de8dec3..2b44d01 100644 --- a/labtech/lab.py +++ b/labtech/lab.py @@ -259,6 +259,7 @@ def get_pbar(self, *, task_type: Type[Task], task_count: int) -> tqdm: total=task_count, bar_format='{desc}: {n_fmt}/{total_fmt} [{elapsed}, {rate_fmt}{postfix}] |{bar}| {percentage:3.0f}% [{remaining} remaining]', disable=self.disable_progress, + dynamic_ncols=True, ) def handle_failure(self, *, ex: Exception, message: str): diff --git a/labtech/monitor.py b/labtech/monitor.py index 5f4ebb1..73bbe11 100644 --- a/labtech/monitor.py +++ b/labtech/monitor.py @@ -49,6 +49,7 @@ def __init__(self, *, line_count: int): self.pbars = [ tqdm( bar_format='{desc}\033[K', + dynamic_ncols=True, ) for _ in range(line_count) ]