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

Show progress bar when downloading package in verbose mode #949

Merged
merged 1 commit into from
Apr 22, 2020

Conversation

atugushev
Copy link
Member

@atugushev atugushev commented Oct 17, 2019

Resolves #832.

Demonstration:

asciicast

Changelog-friendly one-liner: Show progress bar when downloading package in a verbose mode of pip-compile.

Contributor checklist
  • Provided the tests for the changes.
  • Gave a clear one-line description in the PR (that the maintainers can add to CHANGELOG.md on release).
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@atugushev atugushev mentioned this pull request Oct 17, 2019
@atugushev atugushev added the enhancement Improvements to functionality label Oct 17, 2019
@codecov
Copy link

codecov bot commented Oct 21, 2019

Codecov Report

Merging #949 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #949   +/-   ##
=======================================
  Coverage   99.44%   99.45%           
=======================================
  Files          36       36           
  Lines        2540     2554   +14     
  Branches      312      314    +2     
=======================================
+ Hits         2526     2540   +14     
  Misses          8        8           
  Partials        6        6           
Impacted Files Coverage Δ
piptools/logging.py 100.00% <100.00%> (ø)
piptools/repositories/pypi.py 93.68% <100.00%> (+0.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a33e653...31fe23c. Read the comment docs.

@atugushev atugushev added this to the 5.0.0 milestone Feb 28, 2020
@atugushev atugushev changed the title [WIP] Show pip's progress bar when downloading package WIP: Show pip's progress bar when downloading package Mar 28, 2020
@atugushev atugushev changed the title WIP: Show pip's progress bar when downloading package Show progress bar when downloading package in verbose mode Mar 28, 2020
@atugushev atugushev marked this pull request as ready for review March 28, 2020 08:22
@AndydeCleyre
Copy link
Contributor

It looks good! I just want to note, in case this is surprising or not desirable:

If run with stderr in foreground and stdout directed to a file, the progress bar is not shown.

@atugushev
Copy link
Member Author

atugushev commented Apr 12, 2020

Thanks for review @AndydeCleyre! It seems pip prints logs to stdout, but pip-tools to stderr. Then I'll pull this out from the upcoming release and figure out later what to do.

@atugushev atugushev removed this from the 5.0.0 milestone Apr 12, 2020
@atugushev
Copy link
Member Author

atugushev commented Apr 21, 2020

It seems pip prints logs to stdout, but pip-tools to stderr. Then I'll pull this out from the upcoming release and figure out later what to do.

I think we could fix that by patching:

  1. pip's console logger stream to sys.stderr
  2. pip._internal.cli.progress_bars.DownloadProgressSpinner.file = sys.stderr

I also discovered that hashing progress bar prints to stdout (addressed in #1113), could be fixed with progressbar(..., file=sys.stderr)

context_manager = progressbar(chunks, length=iter_length, label=" ")

@atugushev atugushev force-pushed the downloading-progress-bar branch 2 times, most recently from 7485885 to 5cecccf Compare April 21, 2020 10:18
@atugushev
Copy link
Member Author

@AndydeCleyre

Fixed in 5cecccf6085ef11c35e6217a829652b4496a768e. Could you take a look please?

@AndydeCleyre
Copy link
Contributor

LGTM 👍

And thanks for adding the logging comments, especially the difference between pip log level and pip-tools'.

@atugushev atugushev added the logging Related to log or console output label Apr 21, 2020
@atugushev
Copy link
Member Author

atugushev commented Apr 22, 2020

Byt the way, this PR would also help with investigating such issues like #1116 by pip-compile -vv

@atugushev atugushev added this to the 5.1.0 milestone Apr 22, 2020
@atugushev atugushev merged commit 0d84a4c into jazzband:master Apr 22, 2020
@atugushev atugushev deleted the downloading-progress-bar branch April 22, 2020 14:08
@atugushev
Copy link
Member Author

Thank you so much for the feedback @AndydeCleyre!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to functionality logging Related to log or console output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slow compile
2 participants