Skip to content

Commit

Permalink
Drop Kedro 17 (#1669)
Browse files Browse the repository at this point in the history
Kedro-viz should always support last 2 versions of Kedro. Given that Kedro 19 is releasing soon, we can stop supporting Kedro 17 from Kedro-viz 7.0.0 and only support Kedro>18
  • Loading branch information
rashidakanchwala authored Dec 11, 2023
1 parent c0536f2 commit add1895
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 89 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ Finally, you can use pseudo-random data, which is procedurally-generated on page

> **Note**: Kedro-Viz>=3.8.0 will not work with projects created with Kedro<=0.16.6. Please consider migrating your project to Kedro>=0.17.0 before you develop against the latest version of Kedro-Viz.
> **Note**: Kedro-Viz>=7.0.0 will not work with projects created with Kedro<=0.17.0. Please consider migrating your project to Kedro>=0.18.0 before you develop against the latest version of Kedro-Viz.

Before launching a development server with a real Kedro project, you'd need to have [Python](https://www.python.org/)(>=3.8) installed. We strongly recommend setting up [conda](https://docs.conda.io/en/latest/) to manage your Python versions and virtual environments. You can visit Kedro's [guide to installing conda](https://docs.kedro.org/en/latest/get_started/install.html#create-a-virtual-environment-for-your-kedro-project) for more information.

The Kedro-Viz repository comes with an example project in the `demo-project` folder. This is used on the [public demo](https://demo.kedro.org/). To use it in your development environment, you need to install both the Kedro-Viz dependencies and a minimal set of dependencies for the demo project:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions package/features/steps/cli_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,7 @@ def check_kedroviz_up(context):
try:
assert context.result.poll() is None
assert (
# for Kedro 0.17.5
"example_iris_data"
== sorted(data_json["nodes"], key=lambda i: i["name"])[0]["name"]
) or (
# for Kedro 0.18.0 onwards
"X_test"
== sorted(data_json["nodes"], key=lambda i: i["name"])[0]["name"]
"X_test" == sorted(data_json["nodes"], key=lambda i: i["name"])[0]["name"]
)
finally:
context.result.terminate()
104 changes: 26 additions & 78 deletions package/kedro_viz/integrations/kedro/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
load data from projects created in a range of Kedro versions.
"""
# pylint: disable=import-outside-toplevel, protected-access
# pylint: disable=missing-function-docstring, no-else-return
# pylint: disable=missing-function-docstring

import base64
import json
Expand Down Expand Up @@ -33,9 +33,6 @@
from kedro.io import DataCatalog
from kedro.io.core import get_filepath_str
from kedro.pipeline import Pipeline
from packaging.version import parse

from kedro_viz.constants import KEDRO_VERSION

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -64,20 +61,9 @@ def _bootstrap(project_path: Path):
"""Bootstrap the integration by running various Kedro bootstrapping methods
depending on the version
"""
if KEDRO_VERSION >= parse("0.17.3"):
from kedro.framework.startup import bootstrap_project

bootstrap_project(project_path)
return

if KEDRO_VERSION >= parse("0.17.1"):
from kedro.framework.project import configure_project
from kedro.framework.startup import _get_project_metadata

package_name = _get_project_metadata(project_path).package_name
from kedro.framework.startup import bootstrap_project

configure_project(package_name)
return
bootstrap_project(project_path)


def _get_dataset_stats(project_path: Path) -> Dict:
Expand Down Expand Up @@ -128,67 +114,29 @@ def load_data(
"""
_bootstrap(project_path)

if KEDRO_VERSION >= parse("0.17.3"):
from kedro.framework.project import pipelines

with KedroSession.create(
project_path=project_path,
env=env, # type: ignore
save_on_close=False,
extra_params=extra_params, # type: ignore
) as session:
# check for --ignore-plugins option
if ignore_plugins:
session._hook_manager = _VizNullPluginManager()

context = session.load_context()
session_store = session._store
catalog = context.catalog

# Pipelines is a lazy dict-like object, so we force it to populate here
# in case user doesn't have an active session down the line when it's first accessed.
# Useful for users who have `get_current_session` in their `register_pipelines()`.
pipelines_dict = dict(pipelines)
stats_dict = _get_dataset_stats(project_path)

return catalog, pipelines_dict, session_store, stats_dict
elif KEDRO_VERSION >= parse("0.17.1"):
with KedroSession.create(
project_path=project_path,
env=env, # type: ignore
save_on_close=False,
extra_params=extra_params, # type: ignore
) as session:
# check for --ignore-plugins option
if ignore_plugins:
session._hook_manager = _VizNullPluginManager()

context = session.load_context()
session_store = session._store
stats_dict = _get_dataset_stats(project_path)

return context.catalog, context.pipelines, session_store, stats_dict
else:
# Since Viz is only compatible with kedro>=0.17.0, this just matches 0.17.0
from kedro.framework.startup import _get_project_metadata

metadata = _get_project_metadata(project_path)
with KedroSession.create(
package_name=metadata.package_name,
project_path=project_path,
env=env, # type: ignore
save_on_close=False,
extra_params=extra_params, # type: ignore
) as session:
# check for --ignore-plugins option
if ignore_plugins:
session._hook_manager = _VizNullPluginManager()

context = session.load_context()
session_store = session._store
stats_dict = _get_dataset_stats(project_path)

return context.catalog, context.pipelines, session_store, stats_dict
from kedro.framework.project import pipelines

with KedroSession.create(
project_path=project_path,
env=env, # type: ignore
save_on_close=False,
extra_params=extra_params, # type: ignore
) as session:
# check for --ignore-plugins option
if ignore_plugins:
session._hook_manager = _VizNullPluginManager()

context = session.load_context()
session_store = session._store
catalog = context.catalog

# Pipelines is a lazy dict-like object, so we force it to populate here
# in case user doesn't have an active session down the line when it's first accessed.
# Useful for users who have `get_current_session` in their `register_pipelines()`.
pipelines_dict = dict(pipelines)
stats_dict = _get_dataset_stats(project_path)

return catalog, pipelines_dict, session_store, stats_dict


# Try to access the attribute to trigger the import of dependencies, only modify the _load
Expand Down
2 changes: 1 addition & 1 deletion package/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packaging~=23.0
kedro>=0.17.5
kedro>=0.18.0
ipython>=7.0.0, <9.0
fastapi>=0.73.0,<0.200.0
pydantic<2
Expand Down
2 changes: 1 addition & 1 deletion package/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements.txt

kedro >=0.17.0
kedro >=0.18.0
kedro-datasets[pandas.ParquetDataset, pandas.CSVDataset, pandas.ExcelDataset, plotly.JSONDataset]~=1.7
kedro-telemetry>=0.1.1 # for testing telemetry integration
bandit~=1.7
Expand Down

0 comments on commit add1895

Please sign in to comment.