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

Visualise pipeline objects in notebook #2241

Merged
merged 60 commits into from
Feb 25, 2025
Merged

Visualise pipeline objects in notebook #2241

merged 60 commits into from
Feb 25, 2025

Conversation

ravi-kumar-pilla
Copy link
Contributor

@ravi-kumar-pilla ravi-kumar-pilla commented Jan 15, 2025

Description

Resolves #1993

NOTE: The bundle URL will be updated once #2268 is merged

Development notes

  • Created a class NotebookVisualizer and a method show responsible for visualizing Kedro-Viz using the esm bundle in notebook
  • Added load_data_for_notebook_users and load_and_populate_data_for_notebook_users methods to kedro-viz -> integrations -> notebook -> data_loader.py
  • Added initialize and reset methods in data_access_manager for reuse
  • Added few utility functions and classes
  • Update release note, tests and gcp load balancer doc link
  • Removed few GraphQL checks from workflow as they were failing

QA notes

  • All tests should pass
  • For manual testing, open a jupyter notebook and try -
from kedro.pipeline import pipeline, node

def dummy(ds1):
   return ds1
    
n0 = node(dummy, 'flights', 'processed_flights')
dummy_pipe = pipeline([n0])

from kedro_viz.integrations.notebook import NotebookVisualizer
NotebookVisualizer(dummy_pipe).show()

image

  • You can also test demo_project pipelines, try -
from kedro_viz.integrations.notebook import NotebookVisualizer
from demo_project.pipeline_registry import register_pipelines
demo_pipe = register_pipelines()

# Since globalNavigation depends on localStorage, the option is not working.
 
NotebookVisualizer(pipeline=demo_pipe, options={ "display": {
                "expandPipelinesBtn": False,
                "exportBtn": False,
                "labelBtn": False,
                "layerBtn": False,
                "metadataPanel": True,
                "miniMap": False,
                "sidebar": False,
                "zoomToolbar": False,
            },
            "expandAllPipelines": False,
            "behaviour": { 
                "reFocus": False,
            },
            "theme": "dark",
            "width": "100%",
            "height": "600px",   
            }).show()

Testing Results :

Jupyter lab:

image

Databricks:

image

Marimo:
image

VS Code
image

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
…at/umd-viz-bundle

Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
…at/umd-viz-bundle

Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
@astrojuanlu
Copy link
Member

1 more thing @ravi-kumar-pilla : do you think having

def _repr_html_(self):
    from kedro_viz.integrations.notebook import NotebookVisualizer

    return NotebookVisualizer(self).generate_html()

would make

In [2]: pipeline
[Just show the HTML]

work with what's currently in this PR?

(That way the user doesn't even have to do any extra imports for this to work)

@ravi-kumar-pilla
Copy link
Contributor Author

1 more thing @ravi-kumar-pilla : do you think having

def _repr_html_(self):
    from kedro_viz.integrations.notebook import NotebookVisualizer

    return NotebookVisualizer(self).generate_html()

would make

In [2]: pipeline
[Just show the HTML]

work with what's currently in this PR?

(That way the user doesn't even have to do any extra imports for this to work)

Love the idea. Sure we can do that !

Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
@rashidakanchwala rashidakanchwala self-requested a review February 17, 2025 09:25
@rashidakanchwala rashidakanchwala self-requested a review February 18, 2025 15:55
Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @ravi-kumar-pilla , works amazing! I only tried it on jupyter notebooks, but did a lot of iterative building pipeline and it was great.
codewise it is in much better state. thankssss

Copy link
Member

@astrojuanlu astrojuanlu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
@ravi-kumar-pilla
Copy link
Contributor Author

This will be merged after #2237 as suggested by @rashidakanchwala

@astrojuanlu
Copy link
Member

There are some conflicts here, after addressing those this can now be merged @ravi-kumar-pilla

Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi_kumar_pilla <ravi_kumar_pilla@mckinsey.com>
@ravi-kumar-pilla ravi-kumar-pilla changed the title Visualize pipeline objects in notebook Visualise pipeline objects in notebook Feb 25, 2025
@ravi-kumar-pilla ravi-kumar-pilla merged commit 1aae810 into main Feb 25, 2025
37 checks passed
@ravi-kumar-pilla ravi-kumar-pilla deleted the feat/viz-pipe branch February 25, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visualise Pipeline objects
3 participants