-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow passing a --no-progress-bar to the install script to surpress progress bar #4194
Conversation
Thanks for doing this! It mostly looks good to me. Could you fix the PEP8 issues, and add some tests? Also, I'm not 100% comfortable with the double negatives in the
Whether that's straightforward with our current code to handle config, I'm not sure. If not, then I'm OK with a workable compromise, but I'd like the behaviour to be clearly spelled out. |
I wonder if it makes sense to make this a enum instead of a boolean? E.g. instead of |
AFAICT, It is. I've been fiddling with that code. Just adding an option on the command makes it available to the entire configuration setup. |
e655211
to
e80db16
Compare
@pfmoore Thank you !
Not perfect, but I felt this is the best mid way I could find. I was a bit unsure about where and how to plug configuration file options, if you think this is important, I can spend more time on that. @dstufft |
In principle I agree with @dstufft - letting the option choose between "graphical", ASCII or no progress bar is likely to be useful. My only concern is that it's over-generalising. It does nicely avoid the whole |
Note that in #4196 (an alternative PR for this) the option affected |
@AvnerCohen progress bar might also be shown during BTW, most of the other flags names begin with a verb: |
Thanks @orgkhnargh funny coincidence :) I'll add the other commands as you suggested. Will also add testing. |
@dstufft, @orgkhnargh, @pfmoore Unlike the original rather minor change, this is much more elaborate change, I'd appreciate preliminary thoughts on this directions before moving on the finalize this spike. Two things to note:
10x. |
715a066
to
b4f22f7
Compare
I think the idea of implementing the silent mode with a null object makes sense, but I think that rather than giving people the option to select specific named bars (or even force everything to a spinner), using a dictionary like: BAR_TYPES = {
"off": (SilentBar, SilentBar),
"ascii": (Bar, Spinner),
"pretty": (IncrementalBar, Spinner), # If there is a pretty spinner we can add, use it instead
} Then we can use |
@dstufft I'm not sure I follow. Are you suggesting to implement two options: one to choose among {"on", "off", "ascii", "pretty"} and one to choose among {"bar", "spinner"}? UPD: nevermind, I found out what are spinners used for. Sorry. |
@orgkhnargh No sorry, end users only choose between on/off/ascii/pretty. The system choses between the bar or spinner depending on if there is a known, finite end to the progress (e.g. a download of size X) or if it's unknown when it will complete (e.g. setup.py execution). |
febb839
to
bb96486
Compare
@dstufft Implemented this. |
choices=list(BAR_TYPES.keys()), | ||
default='on', | ||
help="Specify type of progress to be displayed [%s]. " % | ||
'|'.join(BAR_TYPES.keys())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add (default: %(default)s)
in the help string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very good 👍
Please also add the option to pip/commands/download.py
(+ the default value in the help string).
A squash, a changelog and this can be merged :)
PS: you have a typo in your commit message (surpress vs suppress).
c70fdcf
to
1c88d44
Compare
Thanks for the review @xavfernandez , hopefully this is covered now, do let me know if anything is still missing. |
choices=list(BAR_TYPES.keys()), | ||
default='on', | ||
help='Specify type of progress to be displayed [%s], ' | ||
'(default: %s)' % ('|'.join(BAR_TYPES.keys()), 'on')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can directly pass %default
in the help string, cf https://github.com/pypa/pip/blob/master/pip/cmdoptions.py#L222
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.. sorry about that, kind of missed that one due to the other interpolation.
Fixed now.
1c88d44
to
eff0bb5
Compare
@@ -10,6 +10,10 @@ | |||
* Add `--exclude-editable` to ``pip freeze`` to exclude editable packages | |||
from installed package list. | |||
|
|||
* Add `--no-progress <progress_bar>` to ``pip download`` and ``pip install`` | |||
to suppress progress bar in the console (:pull:`4194`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The option is --progress-bar
and is also added to pip wheel
:)
Sorry I did not spot this on the last review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spotting!
Apologies for the mix-up and thanks for keeping this clean and tidy !
…all`` to suppress progress bar in the console
eff0bb5
to
0124945
Compare
Thanks a lot :) |
First of all thanks for the patch and getting it merged! We'll start using this flag as soon as possible in our CI scripts :) I just have one question about the 'emoji' progress bar. It seems like a strange addition, why was it added? Also, a minor nitpick, the instruction: "Add Should probably just say "Add |
@jaap3 Glad this is of help. Our CI will benefit just as well, hopefully this will improve electricity consumption across the world with widely distributed reduced logging :)
--progress-bar <progress_bar>
Specify type of progress to be displayed [on|ascii|off|pretty|emoji] (default: on) It's a result of the fact the plan was to originally have a boolean value, we ended up doing a multi-value choice. Not sure if it's worth altering the changelog, I can defiantly patch that if it's worth while. |
Sure, if you can make the changelog clearer, go ahead :) |
Is there any sort of timeline for this making it into a release? The 9.1 milestone seems very far away at the moment, and there are many, many automated builds around the world that would become far more readable if this flag were available. :) |
Ping & sorry to nag, any chance of this going into a release anytime soon? |
For anyone interested, a potential workaround to suppress progress bar until this one is published:
|
@AvnerCohen with your workaround any install fails will return 0 because of "pipe |
@santiagax99 you can use |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Might probably be in complete, first time on this code base, happy to fix whatever needed.
This should fix things like #2369 and #2756
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)