Skip to content

Commit a2fd852

Browse files
committed
Enable colors for Windows terminals and links.
1 parent cf12e94 commit a2fd852

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

src/_pytask/console.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from typing import TYPE_CHECKING
1212
from typing import Any
1313
from typing import Callable
14-
from typing import Literal
1514

1615
from rich.console import Console
1716
from rich.console import RenderableType
@@ -55,14 +54,11 @@
5554
]
5655

5756

58-
IS_WINDOWS_TERMINAL = "WT_SESSION" in os.environ
57+
_IS_WINDOWS_TERMINAL = "WT_SESSION" in os.environ
5958
_IS_WINDOWS = sys.platform == "win32"
6059

6160

62-
_IS_LEGACY_WINDOWS = _IS_WINDOWS and not IS_WINDOWS_TERMINAL
63-
64-
65-
_COLOR_SYSTEM: Literal["auto"] | None = None if _IS_LEGACY_WINDOWS else "auto"
61+
_IS_LEGACY_WINDOWS = _IS_WINDOWS and not _IS_WINDOWS_TERMINAL
6662

6763

6864
_HORIZONTAL_PADDING = (0, 1, 0, 1)
@@ -108,7 +104,7 @@
108104
)
109105

110106

111-
console: Console = Console(theme=theme, color_system=_COLOR_SYSTEM)
107+
console: Console = Console(theme=theme)
112108

113109

114110
def render_to_string(

src/_pytask/logging.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import contextlib
66
import platform
77
import sys
8-
import warnings
98
from typing import TYPE_CHECKING
109
from typing import Any
1110
from typing import NamedTuple
@@ -16,7 +15,6 @@
1615

1716
import _pytask
1817
from _pytask.capture_utils import ShowCapture
19-
from _pytask.console import IS_WINDOWS_TERMINAL
2018
from _pytask.console import console
2119
from _pytask.pluginmanager import hookimpl
2220
from _pytask.reports import ExecutionReport
@@ -52,19 +50,6 @@ def pytask_extend_command_line_interface(cli: click.Group) -> None:
5250
cli.commands["build"].params.append(show_locals_option)
5351

5452

55-
@hookimpl
56-
def pytask_parse_config(config: dict[str, Any]) -> None:
57-
"""Parse configuration."""
58-
if config["editor_url_scheme"] not in ("no_link", "file") and IS_WINDOWS_TERMINAL:
59-
config["editor_url_scheme"] = "file"
60-
warnings.warn(
61-
"Windows Terminal does not support url schemes to applications, yet."
62-
"See https://github.com/pytask-dev/pytask/issues/171 for more information. "
63-
"Resort to `editor_url_scheme='file'`.",
64-
stacklevel=1,
65-
)
66-
67-
6853
@hookimpl
6954
def pytask_post_parse(config: dict[str, Any]) -> None:
7055
# Set class variables on traceback object.

0 commit comments

Comments
 (0)