Skip to content

Commit

Permalink
Merge branch 'main' into feature/feedback-form
Browse files Browse the repository at this point in the history
  • Loading branch information
Huong Nguyen committed Sep 16, 2024
2 parents 28fde20 + 807bab2 commit 1eaa1ba
Show file tree
Hide file tree
Showing 18 changed files with 273 additions and 491 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Update demo-project build directory with the latest changes
run: |
cd demo-project
if ! (kedro viz build |& tee /dev/stderr | grep -i -q "Success!"); then
if ! (kedro viz build --include-previews |& tee /dev/stderr | grep -i -q "Success!"); then
exit 1
fi
shell: bash
Expand Down
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Please follow the established format:
- Add feedback component for slicing pipeline. (#2085)
- Fixes design issues in metadata panel. (#2009)
- Fix missing run command in metadata panel for task nodes. (#2055)
- Add `UnavailableDataset` as a default dataset for `--lite` mode. (#2083)

# Release 9.2.0

Expand Down
Binary file added docs/source/images/viz-in-vscode.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion docs/source/kedro-viz_visualisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,23 @@ import '@quantumblack/kedro-viz/lib/styles/styles.min.css';
const MyApp = () => <div style={{height: `100vh`}}><KedroViz data={json} options={options} /></div>;
```

For more information on how to use kedro as React component with all possible props please refer to [Kedro-Viz on npm](https://www.npmjs.com/package/@quantumblack/kedro-viz)
For more information on how to use Kedro as a React component with all possible props, see [Kedro-Viz on NPM](https://www.npmjs.com/package/@quantumblack/kedro-viz)

## Kedro-Viz in Visual Studio Code Extension

To visualize Kedro project using Kedro-Viz in Visual Studio Code, follow these steps:

1. **Install Kedro Extension**:
Download Kedro extension from [marketplace](https://marketplace.visualstudio.com/items?itemName=kedro.Kedro) into Visual Studio Code.

2. **Setup Kedro Extension**:
Follow steps from [how-to-use-kedro-extension](https://github.com/kedro-org/vscode-kedro)

3. **Open the Command Palette**:
Press `Cmd` + `Shift` + `P` (on macOS) or `Ctrl` + `Shift` + `P` (on Windows/Linux).

4. **Run Kedro-Viz**:
Type `kedro: Run Kedro Viz` and select the command.
This will launch Kedro-Viz and display your pipeline visually within the extension.

![Kedro Viz in VSCode](./images/viz-in-vscode.gif)
119 changes: 88 additions & 31 deletions package-lock.json

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

6 changes: 6 additions & 0 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ For more information on how to use Kedro-Viz as a React component, follow this [
**_Our documentation contains [additional examples on how to visualise with Kedro-Viz.](https://docs.kedro.org/en/stable/visualisation/index.html)_**
## Kedro-Viz in Visual Studio Code Extension
To visualize Kedro project using Kedro-Viz in Visual Studio Code, please install Kedro extension in Visual Studio Code.
For more information on how to use Kedro-Viz in Visual Studio Code, follow this [guide](https://marketplace.visualstudio.com/items?itemName=kedro.Kedro)
## Feature Flags
Kedro-Viz uses features flags to roll out some experimental features. The following flags are currently in use:
Expand Down
2 changes: 1 addition & 1 deletion package/kedro_viz/api/rest/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class DataNodeMetadataAPIResponse(BaseAPIResponse):


class TranscodedDataNodeMetadataAPIReponse(BaseAPIResponse):
filepath: str
filepath: Optional[str] = None
original_type: str
transcoded_types: List[str]
run_command: Optional[str] = None
Expand Down
6 changes: 2 additions & 4 deletions package/kedro_viz/data_access/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import networkx as nx
from kedro.io import DataCatalog
from kedro.io.core import DatasetError
from kedro.io.memory_dataset import MemoryDataset
from kedro.pipeline import Pipeline as KedroPipeline
from kedro.pipeline.node import Node as KedroNode
from sqlalchemy.orm import sessionmaker

from kedro_viz.constants import DEFAULT_REGISTERED_PIPELINE_ID, ROOT_MODULAR_PIPELINE_ID
from kedro_viz.integrations.utils import UnavailableDataset
from kedro_viz.models.flowchart import (
DataNode,
GraphEdge,
Expand Down Expand Up @@ -325,9 +325,7 @@ def add_dataset(
# Kedro Viz in lite mode. The `get_dataset` function
# of DataCatalog calls AbstractDataset.from_config
# which tries to create a Dataset instance from the pattern

# pylint: disable=abstract-class-instantiated
obj = MemoryDataset() # type: ignore[abstract]
obj = UnavailableDataset()

layer = self.catalog.get_layer_for_dataset(dataset_name)
graph_node: Union[DataNode, TranscodedDataNode, ParametersNode]
Expand Down
32 changes: 32 additions & 0 deletions package/kedro_viz/integrations/kedro/abstract_dataset_lite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""``AbstractDatasetLite`` is a custom implementation of Kedro's ``AbstractDataset``
to provide an UnavailableDataset instance when running Kedro-Viz in lite mode.
"""

import logging
from typing import Any, Optional

from kedro.io.core import AbstractDataset, DatasetError

from kedro_viz.integrations.utils import UnavailableDataset

logger = logging.getLogger(__name__)


class AbstractDatasetLite(AbstractDataset):
"""``AbstractDatasetLite`` is a custom implementation of Kedro's ``AbstractDataset``
to provide an UnavailableDataset instance by overriding ``from_config`` of ``AbstractDataset``
when running Kedro-Viz in lite mode.
"""

@classmethod
def from_config(
cls: type,
name: str,
config: dict[str, Any],
load_version: Optional[str] = None,
save_version: Optional[str] = None,
) -> AbstractDataset:
try:
return AbstractDataset.from_config(name, config, load_version, save_version)
except DatasetError:
return UnavailableDataset()
Loading

0 comments on commit 1eaa1ba

Please sign in to comment.