Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress bar does not display until after the first item is complete #1648

Closed
max-sixty opened this issue Aug 16, 2020 · 3 comments · Fixed by #1803
Closed

Progress bar does not display until after the first item is complete #1648

max-sixty opened this issue Aug 16, 2020 · 3 comments · Fixed by #1803
Assignees
Labels
f:progress bar feature: progress bar
Milestone

Comments

@max-sixty
Copy link
Contributor

Take this example:

    with click.progressbar(length=6, label="Doing something") as bar:
        for thing in [3, 2, 1]:
            time.sleep(thing)
            bar.update(thing)

This shows nothing until three seconds, at which point it shows:

Doing something  [##################------------------]   50%  00:00:03

Would it be reasonable for it to display a 0% at first?
This is mostly an issue with a small number of items which take a long time.

@davidism davidism added the f:progress bar feature: progress bar label Aug 16, 2020
@davidism
Copy link
Member

Duplicate of #1353.

@max-sixty
Copy link
Contributor Author

I saw that issue – fine if you prefer to group them. It's not necessarily the same issue though: would be possible to display the last item and start showing from the 0th item.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
@pallets pallets unlocked this conversation Mar 4, 2021
@davidism
Copy link
Member

davidism commented Mar 4, 2021

This was introduced in #487. I just ran into the same confusion when fixing the tests for #1353/#1354, the first line of progress wasn't shown and it wasn't clear why. Reading #487, I'm not convinced by the reasoning, if you have a fast machine or fast process, it doesn't hurt to output the progress bar. I'm going to revert that.

Maybe it would make sense to somehow hide the progress bar if all iterations finish quickly, but otherwise you end up in this weird situation where the bar displays late because the first iteration is always "fast". I don't see a simple way to implement that though, and in general want to avoid adding complexity to Click's progress bar at this point.

@davidism davidism added this to the 8.0.0 milestone Mar 4, 2021
@davidism davidism self-assigned this Mar 4, 2021
@davidism davidism reopened this Mar 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f:progress bar feature: progress bar
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants