diff --git a/docs/source/changes.md b/docs/source/changes.md index 0e2aa95a..fe4eceab 100644 --- a/docs/source/changes.md +++ b/docs/source/changes.md @@ -10,6 +10,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and - {pull}`676` ensures compatibility with click >8.2.0. - {pull}`680` uses uv everywhere. - {pull}`684` adds tests for lowest and highest dependency resolutions. +- {pull}`685` fixes the file urls in task and node names. ## 0.5.3 - 2025-05-16 diff --git a/src/_pytask/console.py b/src/_pytask/console.py index ed932d3f..8a450172 100644 --- a/src/_pytask/console.py +++ b/src/_pytask/console.py @@ -4,14 +4,11 @@ import functools import inspect -import os -import sys from contextlib import suppress from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import Callable -from typing import Literal from rich.console import Console from rich.console import RenderableType @@ -55,16 +52,6 @@ ] -IS_WINDOWS_TERMINAL = "WT_SESSION" in os.environ -_IS_WINDOWS = sys.platform == "win32" - - -_IS_LEGACY_WINDOWS = _IS_WINDOWS and not IS_WINDOWS_TERMINAL - - -_COLOR_SYSTEM: Literal["auto"] | None = None if _IS_LEGACY_WINDOWS else "auto" - - _HORIZONTAL_PADDING = (0, 1, 0, 1) @@ -74,15 +61,15 @@ """ -ARROW_DOWN_ICON = "|" if _IS_LEGACY_WINDOWS else "⬇" -FILE_ICON = "" if _IS_LEGACY_WINDOWS else "📄 " -PYTHON_ICON = "" if _IS_LEGACY_WINDOWS else "🐍 " -TASK_ICON = "" if _IS_LEGACY_WINDOWS else "📝 " +ARROW_DOWN_ICON = "⬇" +FILE_ICON = "📄 " +PYTHON_ICON = "🐍 " +TASK_ICON = "📝 " _EDITOR_URL_SCHEMES: dict[str, str] = { "no_link": "", - "file": "file:///{path}", + "file": "file://{path}", "vscode": "vscode://file/{path}:{line_number}", "pycharm": "pycharm://open?file={path}&line={line_number}", } @@ -108,7 +95,7 @@ ) -console: Console = Console(theme=theme, color_system=_COLOR_SYSTEM) +console: Console = Console(theme=theme) def render_to_string( diff --git a/src/_pytask/logging.py b/src/_pytask/logging.py index 46276f5e..62ab564f 100644 --- a/src/_pytask/logging.py +++ b/src/_pytask/logging.py @@ -5,7 +5,6 @@ import contextlib import platform import sys -import warnings from typing import TYPE_CHECKING from typing import Any from typing import NamedTuple @@ -16,7 +15,6 @@ import _pytask from _pytask.capture_utils import ShowCapture -from _pytask.console import IS_WINDOWS_TERMINAL from _pytask.console import console from _pytask.pluginmanager import hookimpl from _pytask.reports import ExecutionReport @@ -52,19 +50,6 @@ def pytask_extend_command_line_interface(cli: click.Group) -> None: cli.commands["build"].params.append(show_locals_option) -@hookimpl -def pytask_parse_config(config: dict[str, Any]) -> None: - """Parse configuration.""" - if config["editor_url_scheme"] not in ("no_link", "file") and IS_WINDOWS_TERMINAL: - config["editor_url_scheme"] = "file" - warnings.warn( - "Windows Terminal does not support url schemes to applications, yet." - "See https://github.com/pytask-dev/pytask/issues/171 for more information. " - "Resort to `editor_url_scheme='file'`.", - stacklevel=1, - ) - - @hookimpl def pytask_post_parse(config: dict[str, Any]) -> None: # Set class variables on traceback object. diff --git a/tests/test_console.py b/tests/test_console.py index d38cb60d..657ae790 100644 --- a/tests/test_console.py +++ b/tests/test_console.py @@ -37,7 +37,7 @@ def task_func(): ... ("edtior_url_scheme", "expected"), [ ("no_link", ""), - ("file", "link file:///{path}"), + ("file", "link file://{path}"), ("vscode", f"link vscode://file/{{path}}:{_SOURCE_LINE_TASK_FUNC}"), ("pycharm", f"link pycharm://open?file={{path}}&line={_SOURCE_LINE_TASK_FUNC}"), ( @@ -56,7 +56,7 @@ def test_create_url_style_for_task(edtior_url_scheme, expected): ("edtior_url_scheme", "expected"), [ ("no_link", ""), - ("file", "link file:///{path}"), + ("file", "link file://{path}"), ("vscode", "link vscode://file/{path}:1"), ("pycharm", "link pycharm://open?file={path}&line=1"), (