Skip to content

AI junk - #3729

Closed
genrichez wants to merge 1 commit into
pallets:mainfrom
genrichez:fix/progressbar-update-min-steps-finish
Closed

AI junk#3729
genrichez wants to merge 1 commit into
pallets:mainfrom
genrichez:fix/progressbar-update-min-steps-finish

Conversation

@genrichez

Copy link
Copy Markdown

Fix: progressbar not showing full completion with update_min_steps

Fixes #3571.

Problem

When using click.progressbar with show_pos=True and an update_min_steps that isn't a divisor of the iterable length, the final display shows an incomplete position (e.g., 14/20 instead of 20/20 ).

Root Cause

finish() marks the bar as complete but does not flush the remaining _completed_intervals accumulated since the last render. The pos attribute stays at the last rendered value rather than the actual total.

Fix

Flush any remaining _completed_intervals via make_step() at the start of finish(), before setting finished = True. This is a no-op when _completed_intervals is already 0 (i.e., when update_min_steps evenly divides the length).

Testing

  • Full existing test suite: 1940 passed, 0 failures
  • Added 2 regression tests covering the flush case and the no-remainder case

When update_min_steps is not a divisor of the iterable length,
finish() would leave _completed_intervals unflushed, causing pos
to not reflect the actual number of items processed. This resulted
in show_pos displaying e.g. '14/20' instead of '20/20' at completion.

Fix by flushing any remaining _completed_intervals in finish()
before marking the bar as finished.

Fixes pallets#3571
@davidism davidism closed this Jul 25, 2026
@davidism

Copy link
Copy Markdown
Member

@davidism davidism changed the title Fix progressbar not showing full completion with update_min_steps AI junk Jul 25, 2026
@kdeldycke kdeldycke added the rejected AI Contribution rejected because of its untrustworthy AI origin label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected AI Contribution rejected because of its untrustworthy AI origin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

click.progressbar doesn't show full completion when using show_pos=True combined with update_min_steps

3 participants