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

Concurrent progress bars #3252

Merged
merged 21 commits into from
May 27, 2024

Conversation

ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented Apr 24, 2024

Summary

Implements concurrent progress bars. Resolves #1209.

Test Plan

progress-bars.mp4

@ibraheemdev ibraheemdev marked this pull request as ready for review April 24, 2024 22:18
@T-256
Copy link
Contributor

T-256 commented Apr 25, 2024

could it be sorted (the largest at top)?

@ibraheemdev
Copy link
Member Author

@T-256 I put the largest at the bottom which looks more natural, in my opinion.

progress-bars.mp4

@zanieb zanieb added tracing Verbose output and debugging cli Related to the command line interface labels Apr 25, 2024
@charliermarsh
Copy link
Member

The code generally looks good (well done) but need to find a bit of time to play with this myself to see if I have any feedback on the UX.

@ibraheemdev
Copy link
Member Author

Just tested this on a large requirements file, I think any downloads <250kb shouldn't be displayed. The output changes too fast for it to be useful.

Copy link

codspeed-hq bot commented Apr 30, 2024

CodSpeed Performance Report

Merging #3252 will not alter performance

Comparing ibraheemdev:concurrent-progress-bar (0ab84fe) with main (080f095)

Summary

✅ 13 untouched benchmarks

@ibraheemdev
Copy link
Member Author

ibraheemdev commented Apr 30, 2024

We should also probably provide a way to disable this output.

@charliermarsh
Copy link
Member

We could consider making it opt-in. (That would also make it less risky to ship.)

@zanieb
Copy link
Member

zanieb commented Apr 30, 2024

What's the risk, specifically? It seems improbable that this will break people's workflows right?

@zanieb
Copy link
Member

zanieb commented Apr 30, 2024

We do have a preview option now though, if you really want to gate it. A dedicated setting might make sense too? but opt-in seems wrong for that.

@charliermarsh
Copy link
Member

I think the risk is just that it’s overly verbose for most package installs and may require tuning. I would be fine shipping it under preview so we can get feedback on the UI/UX. I haven’t had a chance to play with it myself yet though.

@zanieb
Copy link
Member

zanieb commented Apr 30, 2024

I don't mind iterating on display ux without opt-in, it feels much safer than other changes we make and we release very often.

@zanieb
Copy link
Member

zanieb commented May 3, 2024

Is this waiting on any feedback?

@charliermarsh
Copy link
Member

Yes, from me at least - not sure if others are planning to review.

@zanieb
Copy link
Member

zanieb commented May 23, 2024

I'd love to get this merged, I don't think it's great to have it hanging for weeks. Anything I can do to move this forward?

@charliermarsh
Copy link
Member

Ultimately it's on me to review. However you could test and give feedback on the UX -- it would make it higher-confidence for me if we could get more eyes and opinions on it.

@zanieb
Copy link
Member

zanieb commented May 23, 2024

I did test it and was happy with it but I can do more investigation.

@ibraheemdev can you rebase the branch?

@charliermarsh
Copy link
Member

I will review and merge today.

@ibraheemdev
Copy link
Member Author

ibraheemdev commented May 23, 2024

I'll rebase. I am a little concerned about the output when you have a lot of small downloads though, e.g. #2706 (comment). Even kitty was flickering a little. We can probably buffer updates to the terminal a bit.

@zanieb
Copy link
Member

zanieb commented May 23, 2024

If anyone has "good" test cases post 'em here so we have some common ground when considering the behavior.

@T-256
Copy link
Contributor

T-256 commented May 23, 2024

LGTM and as Charlie said, it could be opt-in via --preview and after stabilization make it default behavior. Also, as Zanie said we can have an option to opt-out from it.

We can probably buffer updates to the terminal a bit.

Let's get some feedback from users, then we can set this interval value with more confidence.

@charliermarsh
Copy link
Member

Should we just move behind preview to unblock the decision? @ibraheemdev do you want it to ship to stable?

@ibraheemdev
Copy link
Member Author

I'm fine with merging this behind preview or an opt-in flag, as long as it's accessible because it can be useful for debugging.

@zanieb
Copy link
Member

zanieb commented May 23, 2024

I have a medium preference for shipping it in stable with an opt-out, but that requires a separate mechanism than --preview 🤷‍♀️

@charliermarsh
Copy link
Member

Let's just move it to --preview to get it unblocked I think.

@charliermarsh
Copy link
Member

I like how pip's progress bars are left-aligned and have a default width -- as-is the display is too wide IMO on my monitor:

Screenshot 2024-05-23 at 11 11 30 PM

Screenshot 2024-05-23 at 11 12 18 PM

How hard is it to achieve something like that?

@charliermarsh
Copy link
Member

To achieve that, I guess we'd need to put the package name above the bar, or to the right of it, to achieve consistent alignment?

@charliermarsh
Copy link
Member

Or use a fixed size for the package name. I can play with it.

@charliermarsh
Copy link
Member

Here's a slightly different layout. The colors are washed out in the video but it's green on dim:

May-23-2024.23-28-19.mp4

@charliermarsh
Copy link
Member

Thoughts?

match self.reporter {
Some(ref reporter) => {
let mut reader =
ProgressReader::new(&mut hasher, progress.unwrap(), &**reporter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like I'm so allergic to unwrap that I'd probably do something like:

let progress = self
    .reporter
    .as_ref()
    .map(|reporter| (reporter, reporter.on_download_start(dist.name(), size)));

And then use match self.progress everywhere. What's your instinct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is nicer, updated.

@ibraheemdev
Copy link
Member Author

@charliermarsh your design looks quite nice, I would be happy to switch to that.

@charliermarsh
Copy link
Member

Sounds good, I'll merge this today. I looked at gating behind preview but honestly looks like kind of a pain haha.

@charliermarsh
Copy link
Member

We can add a --no-progress flag?

@charliermarsh charliermarsh enabled auto-merge (squash) May 27, 2024 00:19
@charliermarsh charliermarsh enabled auto-merge (squash) May 27, 2024 01:07
@charliermarsh charliermarsh merged commit 7dc3226 into astral-sh:main May 27, 2024
46 checks passed
@itayporezky
Copy link

After seeing this in the release notes i was afraid it would cause this
But in my testing it didn't, so that's great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface tracing Verbose output and debugging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show progress bar for slow downloads
5 participants