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

feature render Driver in notebooks #788

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions hamilton/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,16 @@ def __init__(
# TODO -- update this to use the lifecycle methods
self.capture_constructor_telemetry(error, modules, config, adapter)

def _repr_mimebundle_(self, include=None, exclude=None, **kwargs):
"""Attribute read by notebook renderers
This returns the attribute of the `graphviz.Digraph` returned by `self.display_all_functions()`

The parameters `include`, `exclude`, and `**kwargs` are required, but not explicitly used
ref: https://ipython.readthedocs.io/en/stable/config/integrating.html
"""
dot = self.display_all_functions()
return dot._repr_mimebundle_(include=include, exclude=exclude, **kwargs)

def capture_constructor_telemetry(
self,
error: Optional[str],
Expand Down