From 8b0041db6d7d2ba1ff15ae1cb01393ce0264d38f Mon Sep 17 00:00:00 2001 From: Varun Chawla Date: Sat, 7 Feb 2026 23:07:53 -0800 Subject: [PATCH] Enable --pretty by default for better error messages Changed the default value of --pretty from False to True to provide visually nicer output by default. Users can still disable it with --no-pretty if they prefer more concise error messages. Updated defaults in: - mypy/options.py: Changed self.pretty = False to True - mypy/main.py: Changed default=False to default=True for --pretty flag - docs/source/command_line.rst: Added note about default and --no-pretty Fixes #19108 --- docs/source/command_line.rst | 1 + mypy/main.py | 2 +- mypy/options.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index b5081f113f917..5b7f43fce5985 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -937,6 +937,7 @@ in error messages. Use visually nicer output in error messages: use soft word wrap, show source code snippets, and show error location markers. + This is enabled by default. Use :option:`--no-pretty` to disable. .. option:: --no-color-output diff --git a/mypy/main.py b/mypy/main.py index c14bf16929cd9..0e23f6ed87ade 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -1007,7 +1007,7 @@ def add_invertible_flag( ) add_invertible_flag( "--pretty", - default=False, + default=True, help="Use visually nicer output in error messages:" " Use soft word wrap, show source code snippets," " and show error location markers", diff --git a/mypy/options.py b/mypy/options.py index 0a7ddb112e273..46f26b7722d08 100644 --- a/mypy/options.py +++ b/mypy/options.py @@ -365,7 +365,7 @@ def __init__(self) -> None: self.hide_error_codes = False self.show_error_code_links = False # Use soft word wrap and show trimmed source snippets with error location markers. - self.pretty = False + self.pretty = True self.dump_graph = False self.dump_deps = False self.logical_deps = False