-
Notifications
You must be signed in to change notification settings - Fork 414
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
Add text color capability for Windows #612
Conversation
colorama also handles tty detection so |
There's also this: https://stackoverflow.com/questions/12492810/python-how-can-i-make-the-ansi-escape-codes-to-work-also-in-windows/60194390#60194390 |
To follow up on my last comment, this https://stackoverflow.com/a/36760881 gives some more information. It seems that it's only turning on Windows' native ANSI-interpreter. So the simple non-colorama code might not help people whose Windows doesn't have ANSI capabilities. |
That's a good point. I think I will leave it in. If I read colorama's docs right, it's still trying to filter out all the color codes in a non-tty environment. So since we don't add the codes in the first place in the that case, I like not having to filter |
Thanks for the independent test, @CarliJoy , that seems to work as expected, the codes still visible are fixed in the other PR. |
Another possible option would just be to use colorama for everything--so the "color functions" would always add the color escape codes, and we rely on colorama to remove them if we're not in a tty. I didn't go this route just out of conservatism (original code works) and because I have no idea how much overhead this would add. |
Add app_name "pipx" to ensurepath comments, don't duplicate bin_paths. Apply typing.NoReturn to code base (pypa#605) Fix post-release development versioning (pypa#601) Make constants.py single source for WINDOWS boolean. (pypa#607) Add section on where pipx keeps its logs. (pypa#608) Upgrade all pre-commit plugins except black. (pypa#611) Fix show/hide cursor for older Windows (pypa#610) Drop .exe appending on Windows (pypa#606) This makes Venv.run_app() and code path along it accept an additional argument, so we can distinguish between the "real" name (filename) of an app, and the name supplied by the user. This makes the code simpler, espacially when dealing with the proposed [pipx.run] entry points. Add text color capability for Windows (pypa#612) Better Unicode / emoji capability detection (pypa#614) Use python 3.9 as default python for CI. (pypa#622) Don't show / hide cursor if not in tty. (pypa#620)
docs/changelog.md
Summary of changes
With colorama it is ridiculously easy to support text color output on Windows, so I added it with this PR. It adds polish and brings the Windows experience in line with other platforms.
Test plan
Tested by running
On Windows both the bold list formatting and the green of the verbose output show up. (They don't with existing pipx.)