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

Force colors from mypy always, strip in pants when --no-colors (Cherry-pick of #16586) #16808

Merged
merged 1 commit into from Sep 9, 2022

Conversation

stuhood
Copy link
Sponsor Member

@stuhood stuhood commented Sep 9, 2022

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]

…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]
@stuhood stuhood merged commit 564e6ec into pantsbuild:2.14.x Sep 9, 2022
@stuhood stuhood deleted the cherry-pick-16586-to-2.14.x branch September 9, 2022 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants