From c865bfabe646e6631c4b02546b56a33841e0891c Mon Sep 17 00:00:00 2001 From: ravi-kumar-pilla Date: Wed, 15 Nov 2023 16:33:48 -0600 Subject: [PATCH 1/3] add deprecation warning for cli Signed-off-by: ravi-kumar-pilla --- package/kedro_viz/launchers/cli.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/kedro_viz/launchers/cli.py b/package/kedro_viz/launchers/cli.py index ed974a6490..506521d50d 100644 --- a/package/kedro_viz/launchers/cli.py +++ b/package/kedro_viz/launchers/cli.py @@ -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() From f7563f9d8b35f4c8453749f7040fd0507447f10e Mon Sep 17 00:00:00 2001 From: ravi-kumar-pilla Date: Wed, 15 Nov 2023 17:20:09 -0600 Subject: [PATCH 2/3] update pytest Signed-off-by: ravi-kumar-pilla --- RELEASE.md | 3 +- package/kedro_viz/launchers/cli.py | 2 +- package/tests/test_launchers/test_cli.py | 44 ++++++++++++++++++------ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 79431f4b81..a7147489a5 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -11,9 +11,10 @@ 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) - Refactor flowchart dataclasses to pydantic base models. (#1565) +- Add kedro viz CLI command deprecation warning. (#1641) # Release 6.6.1 diff --git a/package/kedro_viz/launchers/cli.py b/package/kedro_viz/launchers/cli.py index 506521d50d..046d3dee3d 100644 --- a/package/kedro_viz/launchers/cli.py +++ b/package/kedro_viz/launchers/cli.py @@ -122,7 +122,7 @@ 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. ", + "Kedro-Viz 7.0.0. `kedro viz run` will be the new way to run the tool.", fg="yellow", ), ) diff --git a/package/tests/test_launchers/test_cli.py b/package/tests/test_launchers/test_cli.py index f74b99be6c..a7dce2cea9 100644 --- a/package/tests/test_launchers/test_cli.py +++ b/package/tests/test_launchers/test_cli.py @@ -1,3 +1,5 @@ +from unittest.mock import call + import pytest import requests from click.testing import CliRunner @@ -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): @@ -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): @@ -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( From bddad630045bc96a68f4e9ec3c03ddefcebaac11 Mon Sep 17 00:00:00 2001 From: ravi-kumar-pilla Date: Thu, 16 Nov 2023 09:12:17 -0600 Subject: [PATCH 3/3] add viz deprecation warning to docs Signed-off-by: ravi-kumar-pilla --- docs/source/kedro-viz_visualisation.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/source/kedro-viz_visualisation.md b/docs/source/kedro-viz_visualisation.md index 6d68dc9429..fc7ae7b92e 100644 --- a/docs/source/kedro-viz_visualisation.md +++ b/docs/source/kedro-viz_visualisation.md @@ -32,6 +32,11 @@ To start Kedro-Viz, type the following into your terminal from the project direc kedro viz ``` +```{important} +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. +``` + The command opens a browser tab to serve the visualisation at `http://127.0.0.1:4141/`. You should see the following: