Merged
Conversation
Contributor
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 |
Contributor
Author
|
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 |
skrawcz
approved these changes
May 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a plugin to convert Kedro
Pipelineobjects 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.pywith 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).