diff --git a/mypy/dmypy/client.py b/mypy/dmypy/client.py index 4791fe337f09..90c3062bcbe5 100644 --- a/mypy/dmypy/client.py +++ b/mypy/dmypy/client.py @@ -36,6 +36,9 @@ def __init__(self, prog: str, **kwargs: Any) -> None: parser = argparse.ArgumentParser( prog="dmypy", description="Client for mypy daemon mode", fromfile_prefix_chars="@" ) +if sys.version_info >= (3, 14): + parser.color = True # Set as init arg in 3.14 + parser.set_defaults(action=None) parser.add_argument( "--status-file", default=DEFAULT_STATUS_FILE, help="status file to retrieve daemon details" diff --git a/mypy/main.py b/mypy/main.py index c1e4f989ab98..7bd7215bbe2a 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -491,6 +491,8 @@ def process_options( stdout=stdout, stderr=stderr, ) + if sys.version_info >= (3, 14): + parser.color = True # Set as init arg in 3.14 strict_flag_names: list[str] = [] strict_flag_assignments: list[tuple[str, bool]] = [] diff --git a/mypy/stubgen.py b/mypy/stubgen.py index ba0a3f9dade6..3173bfdf9f5c 100755 --- a/mypy/stubgen.py +++ b/mypy/stubgen.py @@ -1851,6 +1851,8 @@ def parse_options(args: list[str]) -> Options: parser = argparse.ArgumentParser( prog="stubgen", usage=HEADER, description=DESCRIPTION, fromfile_prefix_chars="@" ) + if sys.version_info >= (3, 14): + parser.color = True # Set as init arg in 3.14 parser.add_argument( "--ignore-errors", diff --git a/mypy/stubtest.py b/mypy/stubtest.py index 6c90913885c9..ea09dac8ec95 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -2084,6 +2084,8 @@ def parse_options(args: list[str]) -> _Arguments: parser = argparse.ArgumentParser( description="Compares stubs to objects introspected from the runtime." ) + if sys.version_info >= (3, 14): + parser.color = True # Set as init arg in 3.14 parser.add_argument("modules", nargs="*", help="Modules to test") parser.add_argument( "--concise",