-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
Force colors from mypy always, strip in pants when --no-colors #16586
Conversation
[ci skip-rust] [ci skip-build-wheels]
NB. this is exactly the removed code from #16488, without fixing the linux-specific problems described in #16488 (comment). If someone else hasn't magically solved them for me, I'll try to work through it sometime next week. |
[ci skip-rust] [ci skip-build-wheels]
|
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.
Awesome, thanks a lot!
report: Digest = EMPTY_DIGEST, | ||
) -> CheckResult: | ||
def prep_output(s: bytes) -> str: | ||
return strip_v2_chroot_path(s) if strip_chroot_path else s.decode() | ||
chroot = strip_v2_chroot_path(s) if strip_chroot_path else s.decode() | ||
formatting = cast(str, colors.strip_color(chroot)) if strip_formatting else chroot |
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.
I'm pretty sure this cast is safe, because strip_colors
uses a str
regex rather than a binary one?
Yay, thanks! |
…build#16586) This fixes pantsbuild#16451 by continuing the color half of pantsbuild#16488 (terminal width). It does this by forcing mypy to always include color escapes, and then stripping them out in pants, based on the [GLOBAL].colors setting. This seems to only be possible via an undocumented environment variable: `MYPY_FORCE_COLOR`: python/mypy#7771, https://github.com/python/mypy/blob/03638dd670373db0b8f00cc3bcec256d09729d06/mypy/util.py#L543 Doing this also requires setting `TERM=linux` so that curses can find appropriate info in the terminfo database. [ci skip-rust] [ci skip-build-wheels]
…y-pick of #16586) (#16808) This fixes #16451 by continuing the color half of #16488 (terminal width). It does this by forcing mypy to always include color escapes, and then stripping them out in pants, based on the [GLOBAL].colors setting. This seems to only be possible via an undocumented environment variable: `MYPY_FORCE_COLOR`: python/mypy#7771, https://github.com/python/mypy/blob/03638dd670373db0b8f00cc3bcec256d09729d06/mypy/util.py#L543 Doing this also requires setting `TERM=linux` so that curses can find appropriate info in the terminfo database. [ci skip-rust] [ci skip-build-wheels]
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.
Thanks!! Exciting :)
This fixes #16451 by continuing the color half of #16488 (terminal width).
It does this by forcing mypy to always include color escapes, and then stripping them out in pants, based on the [GLOBAL].colors setting.
This seems to only be possible via an undocumented environment variable:
MYPY_FORCE_COLOR
: python/mypy#7771, https://github.com/python/mypy/blob/03638dd670373db0b8f00cc3bcec256d09729d06/mypy/util.py#L543Doing this also requires setting
TERM=linux
so that curses can find appropriate info in the terminfo database.[ci skip-rust]
[ci skip-build-wheels]