-
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
pip needs a way to force all colours off #2449
Comments
Yes please. |
Also, on windows using git-bash the ansi escape sequences may not be interpreted correctly. For example I am seeing:
I suspect this is a problem with colorama, but it would be nice to just be able to disable all colors etc.. on command line and via switch. |
Would also like to see this. We are having issues with |
This issue is somewhat related to #3771 |
Same thing when building docker images with PyCharm. The ANSI sequences and deflated output make it hard to spot issues quickly. |
+1 - this ansi colors don't play well when running pip on remote machine via fabric. |
Related. I would argue this behavior should be like "ls --colors" in that it should have an auto mode which disables coloring when not a tty but also allow for manual override. For instance, in the Jenkins use-case mentioned above, I have the Jenkins ANSI Terminal plugin installed and enabled but I'm currently not able to get colored output because colorize detects that stdout/stderr is not a tty. |
Agree with nrvale0. Though I guess auto mode would be current situation, additions would be the always enable and always disable modes. |
This is a fix for issue pypa#2449 All it does is simply add a global option --no-color Internally it switches ColorizedStreamHandler to StreamHandler if this flag is detected.
* Add a global option to disable colors This is a fix for issue #2449 All it does is simply add a global option --no-color Internally it switches ColorizedStreamHandler to StreamHandler if this flag is detected. * Fix lint errors * not sure it makes the code more readable though ... * Fix typo * Choose logging class before assigning * As requested per review * Make the code shorter and easier to follow * Be polite to followers, add commas * Add functional test for the --no-color output * Better detection of windows * Fix fragile tests - can't trust script --quiet * The version found in Travis-CI does not respect this flag It added a prefix line and suffix line found if one does not add the flag --quiet (script from util-linux 2.26.2). As such the out put is: Script started on Fri 27 Oct 2017 07:17:30 AM CEST \x1b[31mCannot uninstall requirement noSuchPackage, not installed\x1b[0m\n Script done on Fri 27 Oct 2017 07:17:31 AM CEST With this change, the test should pass, and is hopefully more stable. * Simplify testing for color or no-color
I consider this fixed by #4739. |
Awesome! |
* Add a global option to disable colors This is a fix for issue pypa#2449 All it does is simply add a global option --no-color Internally it switches ColorizedStreamHandler to StreamHandler if this flag is detected. * Fix lint errors * not sure it makes the code more readable though ... * Fix typo * Choose logging class before assigning * As requested per review * Make the code shorter and easier to follow * Be polite to followers, add commas * Add functional test for the --no-color output * Better detection of windows * Fix fragile tests - can't trust script --quiet * The version found in Travis-CI does not respect this flag It added a prefix line and suffix line found if one does not add the flag --quiet (script from util-linux 2.26.2). As such the out put is: Script started on Fri 27 Oct 2017 07:17:30 AM CEST \x1b[31mCannot uninstall requirement noSuchPackage, not installed\x1b[0m\n Script done on Fri 27 Oct 2017 07:17:31 AM CEST With this change, the test should pass, and is hopefully more stable. * Simplify testing for color or no-color
According to http://bugs.python.org/issue18553 this code https://github.com/pypa/pip/blob/develop/pip/utils/logging.py#L91-L93 is not completely reliable under Windows as isatty may return True even for non-tty pipes. pip should have an option (eg --no-color) to disable all colour options if it's being called as a subprocess to override automatic checking for whether colouring should be used. Current functionality is fine as default as it's reasonable to expect that most users will be running pip from a real terminal on Windows anyway
The text was updated successfully, but these errors were encountered: