-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Bug Report
This is admittedly a very stupid, trivial thing, but it is an annoyance.
Many terminal applications augment the shell output they display with rich features, including automatic conversion of printed URLs to active hyperlinks.
In an 80-column terminal, because at least one of the URLs displayed by mypy --help
is too long to fit in an 80-column terminal, it gets split across two lines in the help output.
Compounding the issue is that the URL is displayed in an indented context, so both lines of output have spaces inserted before them. On the second line, these spaces fall in the middle of the URL fragment, fouling the terminal's automatic linking by chopping off the end of the URL.
To Reproduce
- Run a graphical terminal (such as
gnome-terminal
or macOSTerminal.app
) which automatically links URLs in the output. - Resize the window to 80 characters wide (standard graybeard width).
- Run
mypy --help
from any recent version (tested in1.0.1
and1.17.1
) - Find whatever URL is included in the "None and Optional handling" section
- Either:
- Hover over it with the pointer, to determine how much of it is linked
- Click/right-click on it, to open the URL in a web browser
Expected Behavior
The entire URL is output as a continuous, unbroken string. This is then automatically converted into a link to the referenced page.
Actual Behavior
The output is formatted similar to these examples:
$ /usr/bin/mypy --version
mypy 1.17.1 (compiled: no)
$ /usr/bin/mypy --help
# -- 8< -- snip -- 8< --
None and Optional handling:
Adjust how values of type 'None' are handled. For more context on how mypy
handles values of type 'None', see:
https://mypy.readthedocs.io/en/stable/kinds_of_types.html#optional-types-
and-the-none-type
# -- 8< -- snip -- 8< --
$ mypy --version
mypy 1.0.1 (compiled: yes)
$ mypy --help
# -- 8< -- snip -- 8< --
None and Optional handling:
Adjust how values of type 'None' are handled. For more context on how mypy
handles values of type 'None', see:
https://mypy.readthedocs.io/en/stable/kinds_of_types.html#no-strict-
optional
# -- 8< -- snip -- 8< --
The second URL ends up becoming:
That one is outdated and no longer valid anyway. (PR #19252 updated the help to use a new, correct link target in newer mypy
releases.)
But that new first URL:
is just as invalid, only because the end of its fragment is chopped off.
Your Environment
- Mypy version used: 1.0.1, 1.17.1
- Mypy command-line flags:
--help
- Python version used: 3.9, 3.13
Additional Notes
As a somewhat-related aside, there are two more --help
URLs, in the "Incremental mode" and "Running code" sections, that don't have the https://
scheme identifier at the start. Meaning they also aren't parsed as hyperlinks. But those are pretty trivially fixable, and they're both short enough that they still won't wrap.
Oh, and apologies if I should've filed this as a "Documentation" bug instead, I couldn't quite decide.