-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
mypy output is limited to 80 characters wide and no colours #16451
Labels
Comments
Eric-Arellano
pushed a commit
that referenced
this issue
Aug 19, 2022
This fixes part of #16451 by ensuring that the mypy output isn't truncated/hard-wrapped at all. In particular: the terminal width is forcibly set to be very wide ("infinite") because soft-wrapped display in a wide terminal is nicer than it being hard-wrapped/truncated to 80 cols. This seems to only be possible via an undocumented environment variable: `MYPY_FORCE_TERMINAL_WIDTH`: https://github.com/python/mypy/blob/03638dd670373db0b8f00cc3bcec256d09729d06/mypy/util.py#L468 [ci skip-rust]
cczona
pushed a commit
to cczona/pants
that referenced
this issue
Sep 1, 2022
This fixes part of pantsbuild#16451 by ensuring that the mypy output isn't truncated/hard-wrapped at all. In particular: the terminal width is forcibly set to be very wide ("infinite") because soft-wrapped display in a wide terminal is nicer than it being hard-wrapped/truncated to 80 cols. This seems to only be possible via an undocumented environment variable: `MYPY_FORCE_TERMINAL_WIDTH`: https://github.com/python/mypy/blob/03638dd670373db0b8f00cc3bcec256d09729d06/mypy/util.py#L468 [ci skip-rust]
stuhood
pushed a commit
that referenced
this issue
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]
stuhood
pushed a commit
to stuhood/pants
that referenced
this issue
Sep 9, 2022
…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
added a commit
that referenced
this issue
Sep 9, 2022
…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]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Mypy has various nifty affordances to make it easier to understand its errors, e.g. colours and (with
--pretty
) printing the relevant line. It seems like pants currently gets in the way of these, presumably because mypy is detecting the non-tty output buffering.For instance, https://gist.github.com/ce2e03d8788848ad6db27df6d66cde6d
Running mypy via
./pants check ::
gives output:While running it normally
mypy --pretty broken.py
(with the same version 0.961 installed via pip) gives output:The first output is worse:
Pants version
OS
macOS
Additional info
Exact reproduction steps:
git clone https://gist.github.com/ce2e03d8788848ad6db27df6d66cde6d cd ce2e03d8788848ad6db27df6d66cde6d ./pants check :: mypy --version mypy --pretty broken.py
The text was updated successfully, but these errors were encountered: