GitHub user skrawcz edited a comment on the discussion: APIs for updating
underlying function of a node (2 part question)
> What does "override" refer to here?
Overrides is what we can do to an instantiated driver object. Right now we can
provide values that override a node.
What you suggest here would be a form of it:
> driver = driver.update(date=new_date, in_path=['shipment_view'])
> driver.execute('main_view')
> One other way I could see this working which is more consistent with
> @config.when for node replacement, would be something like
> @path.passes_through, which could work something like this:
>
> def X() -> int:
> return 9
>
> @path.passes_through('B', name='X')
> def X_prime() -> int:
> return 99
I see. So this feels like you just want to avoid having to update B's
parameters for this to work. Since I feel it's not that many more characters to
update B's parameter and not have the decorator here.
I think I'd want this instead:
```python
@path.passes_through(B, name=X) # could we do references? or would that be too
constraining?
def X_prime() -> int:
return 99
```
Edge cases to think about:
1. how would one debug this? What would show up in the "viz" view?
2. Is the main use case to apply updates given a graph? Since I think if it's
static code that is checked in and not touched again, I'd just argue that
people should make the edits...
3. could a LSP server help stitch together autocomplete / a view of the graph
easily? (we haven't put much time into the vscode plugin, but we could...)
I like this:
> driver = driver.update(date=new_date, in_path=['shipment_view'])
and/or combining it with the above
```
# some module
@path.passes_through('B', name='X')
def X_prime() -> int:
return 99
```
After all Hamilton is just nodes and edges. So "graph chaining" and this type
of "graph overrides/transformation" doesn't seem out of the realm of what
Hamilton could support.
GitHub link:
https://github.com/apache/hamilton/discussions/1397#discussioncomment-14589291
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]