Kedro-Viz

12.3.0 · active · verified Mon Apr 13

Kedro-Viz helps visualise Kedro data and analytics pipelines, offering a web-based UI to explore the structure and dependencies of projects. The current version is 12.3.0, and it follows a regular release cadence, typically with minor versions every 1-2 months addressing features, bug fixes, and compatibility with the Kedro framework.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to run Kedro-Viz programmatically for a minimal Kedro project. In a real scenario, you would navigate to your Kedro project directory in the terminal and run `kedro viz`, or use `%load_ext kedro.ipython` and then `%run_viz` within a Jupyter notebook.

import os
from kedro.framework.session import KedroSession
from kedro.framework.startup import bootstrap_project
from kedro_viz.server import run_viz

# Simulate a minimal Kedro project structure for quickstart
project_path = './my_kedro_project'
if not os.path.exists(project_path):
    os.makedirs(os.path.join(project_path, 'src', 'my_kedro_project', 'pipelines', 'data_processing'))
    with open(os.path.join(project_path, 'pyproject.toml'), 'w') as f:
        f.write('[tool.kedro]\npackage_name = "my_kedro_project"')
    with open(os.path.join(project_path, 'src', 'my_kedro_project', 'pipeline_registry.py'), 'w') as f:
        f.write("""
from kedro.pipeline import Pipeline, node

def create_pipeline(**kwargs):
    return Pipeline([
        node(lambda x: x + 1, 'input_data', 'intermediate_data', name='add_one_node'),
        node(lambda x: x * 2, 'intermediate_data', 'output_data', name='multiply_two_node')
    ])

def register_pipelines():
    return {
        "__default__": create_pipeline()
    }
""")
    with open(os.path.join(project_path, 'src', 'my_kedro_project', '__init__.py'), 'w') as f:
        f.write('')

# Bootstrap the Kedro project
os.chdir(project_path)
bootstrap_project(project_path)

# Run Kedro-Viz programmatically (this will open in your browser)
print(f"Running Kedro-Viz for project at {project_path}. Access it in your browser, typically at http://127.0.0.1:4141")
run_viz(project_path=project_path, port=4141, autoreload=False)

view raw JSON →