Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kedro viz deprecation warning for CLI #1641

Merged
merged 5 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ Please follow the established format:
## Bug fixes and other changes

- Fix dataset factory patterns in Experiment Tracking. (#1588)
- Improved feedback for copy to clipboard feature. (#1614)
- Improve feedback for copy to clipboard feature. (#1614)
- Ensure Kedro-Viz works when hosted on a URL subpath. (#1621)
- Fix shareable URL modal to appear across the app. (#1639)
- Refactor flowchart dataclasses to pydantic base models. (#1565)
- Add kedro viz CLI command deprecation warning. (#1641)

# Release 6.6.1

Expand Down
8 changes: 8 additions & 0 deletions package/kedro_viz/launchers/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ def viz(
),
)

click.echo(
click.style(
"WARNING: The `kedro viz` command will be deprecated with the release of "
"Kedro-Viz 7.0.0. `kedro viz run` will be the new way to run the tool.",
fg="yellow",
),
)

try:
if port in _VIZ_PROCESSES and _VIZ_PROCESSES[port].is_alive():
_VIZ_PROCESSES[port].terminate()
Expand Down
44 changes: 34 additions & 10 deletions package/tests/test_launchers/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from unittest.mock import call

import pytest
import requests
from click.testing import CliRunner
Expand Down Expand Up @@ -134,14 +136,22 @@ def test_kedro_viz_command_should_log_outdated_version(mocker, mock_http_respons
with runner.isolated_filesystem():
runner.invoke(cli.commands, ["viz"])

mock_click_echo.assert_called_once_with(
"\x1b[33mWARNING: You are using an old version of Kedro Viz. "
f"You are using version {installed_version}; "
f"however, version {mock_version} is now available.\n"
"You should consider upgrading via the `pip install -U kedro-viz` command.\n"
"You can view the complete changelog at "
"https://github.com/kedro-org/kedro-viz/releases.\x1b[0m"
)
mock_click_echo_calls = [
call(
"\x1b[33mWARNING: You are using an old version of Kedro Viz. "
f"You are using version {installed_version}; "
f"however, version {mock_version} is now available.\n"
"You should consider upgrading via the `pip install -U kedro-viz` command.\n"
"You can view the complete changelog at "
"https://github.com/kedro-org/kedro-viz/releases.\x1b[0m"
),
call(
"\x1b[33mWARNING: The `kedro viz` command will be deprecated with the release of "
"Kedro-Viz 7.0.0. `kedro viz run` will be the new way to run the tool.\x1b[0m",
),
]

mock_click_echo.assert_has_calls(mock_click_echo_calls)


def test_kedro_viz_command_should_not_log_latest_version(mocker, mock_http_response):
Expand All @@ -156,7 +166,14 @@ def test_kedro_viz_command_should_not_log_latest_version(mocker, mock_http_respo
with runner.isolated_filesystem():
runner.invoke(cli.commands, ["viz"])

mock_click_echo.assert_not_called()
mock_click_echo_calls = [
call(
"\x1b[33mWARNING: The `kedro viz` command will be deprecated with the release of "
"Kedro-Viz 7.0.0. `kedro viz run` will be the new way to run the tool.\x1b[0m",
)
]

mock_click_echo.assert_has_calls(mock_click_echo_calls)


def test_kedro_viz_command_should_not_log_if_pypi_is_down(mocker, mock_http_response):
Expand All @@ -169,7 +186,14 @@ def test_kedro_viz_command_should_not_log_if_pypi_is_down(mocker, mock_http_resp
with runner.isolated_filesystem():
runner.invoke(cli.commands, ["viz"])

mock_click_echo.assert_not_called()
mock_click_echo_calls = [
call(
"\x1b[33mWARNING: The `kedro viz` command will be deprecated with the release of "
"Kedro-Viz 7.0.0. `kedro viz run` will be the new way to run the tool.\x1b[0m",
)
]

mock_click_echo.assert_has_calls(mock_click_echo_calls)


def test_kedro_viz_command_with_autoreload(
Expand Down