Skip to content

Commit 687742a

Browse files
qraqrasasai-r
andauthored
Show time taken instead of eta 0:00:00 after download completion (#13486)
This is more useful than seeing eta 0:00:00. There is an extra space left over, but there isn't much we can do about that unfortunately. It'd be nice if Rich wouldn't add the space if the column was empty, but looking at their codebase, such a change seems nontrivial. Co-authored-by: asai-r <[email protected]>
1 parent 17794fd commit 687742a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

news/13483.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Show time taken instead of ``eta 0:00:00`` at download completion.

src/pip/_internal/cli/progress_bars.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,21 @@ def _rich_download_progress_bar(
5353
BarColumn(),
5454
DownloadColumn(),
5555
TransferSpeedColumn(),
56-
TextColumn("eta"),
57-
TimeRemainingColumn(),
56+
TextColumn("{task.fields[time_description]}"),
57+
TimeRemainingColumn(elapsed_when_finished=True),
5858
)
5959

6060
progress = Progress(*columns, refresh_per_second=5)
61-
task_id = progress.add_task(" " * (get_indentation() + 2), total=total)
61+
task_id = progress.add_task(
62+
" " * (get_indentation() + 2), total=total, time_description="eta"
63+
)
6264
if initial_progress is not None:
6365
progress.update(task_id, advance=initial_progress)
6466
with progress:
6567
for chunk in iterable:
6668
yield chunk
6769
progress.update(task_id, advance=len(chunk))
70+
progress.update(task_id, time_description="")
6871

6972

7073
def _rich_install_progress_bar(

0 commit comments

Comments
 (0)