-
Notifications
You must be signed in to change notification settings - Fork 133
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
plugins
Kedro
#916
plugins
Kedro
#916
Conversation
Sweep: PR Reviewexamples/kedro/README.mdUpdated the description of examples/kedro/kedro-code/src/kedro_code/pipelines/data_science/nodes.pyAdded a return type annotation hamilton/function_modifiers/base.pyAdded "kedro" to the list of plugin modules to be loaded by the registry. requirements-test.txtAdded the |
For Python <3.11, Essentially, the condition from typing import Any
from hamilton.function_modifiers import extract_fields
@extract_fields(dict(B=Any, C=Any))
def A() -> dict:
return dict(B=True, C=1)
if __name__ == "__main__":
import __main__
from hamilton import driver
dr = driver.Builder().with_modules(__main__).build()
res = dr.execute(["B", "C"]) Traceback (most recent call last):
File "/home/tjean/projects/dagworks/hamilton/bug.py", line 6, in <module>
@extract_fields(dict(
File "/home/tjean/projects/dagworks/hamilton/hamilton/function_modifiers/expanders.py", line 748, in __init__
_validate_extract_fields(fields)
File "/home/tjean/projects/dagworks/hamilton/hamilton/function_modifiers/expanders.py", line 728, in _validate_extract_fields
raise base.InvalidDecoratorException(
hamilton.function_modifiers.base.InvalidDecoratorException: Error, found these ['B does not declare a type. Instead it passes typing.Any.', 'C does not declare a type. Instead it passes typing.Any.']. Please pass in a dict of string to types. I previously discussed the issue with @elijahbenizzy in the context of this plugin, but I'm now fixing it given the bug it broader than the plugin itself |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. I haven't tested it but from the demo you showed it works. I would squash commit and write up any design decisions in the commit.
Added a plugin to convert Kedro
Pipeline
objects to HamiltonDriver
. This allows Kedro users to benefit from the ergonomics of Hamilton and it's powerful Hamilton UI observability features.Changes
hamilton/plugins/h_kedro.py
with the Pipeline to Driver conversionhamilton/examples/kedro/kedro-plugin/
with a README and a tutorial notebookHow I tested this
tests/plugins/test_h_kedro.py
. It focuses on the supporting Kedro nodes that return multiple values while Hamilton nodes return a single value (and may use@extract_fields
).