Skip to content

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

@maarten-ic

Description

@maarten-ic

Using a click.progressbar with:

  • update_min_steps which isn't a divisor of length
  • show_pos=True

won't show full completion at the end. This can be reproduced as follows:

import time

import click

with click.progressbar(
    range(20),
    show_pos=True,
    update_min_steps=7,
) as bar:
    for i in bar:
        time.sleep(0.1)

with (final) output in the terminal

  [####################################]  14/20          

Expected behaviour: I had expected the output to show 20/20 at the end.
This would be consistent with the default percentage formatting, as can be seen by commenting the line show_pos=True and re-running the reproduction:

  [####################################]  100%          

Environment:

  • Python version: tested with 3.12.3 and 3.14.3
  • Click version: 8.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions