-
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
@ignore #1172
@ignore #1172
Conversation
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.
👍 Looks good to me! Reviewed everything up to be0025a in 29 seconds
More details
- Looked at
275
lines of code in8
files - Skipped
1
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. hamilton/function_modifiers/__init__.py:32
- Draft comment:
Theignore
decorator is being instantiated incorrectly. It should be used directly without callingignore()
. - Reason this comment was not posted:
Marked as duplicate.
2. hamilton/function_modifiers/configuration.py:285
- Draft comment:
Theignore
decorator is being instantiated incorrectly. It should be used directly without callingignore()
. - Reason this comment was not posted:
Marked as duplicate.
3. hamilton/function_modifiers/macros.py:624
- Draft comment:
Theignore
decorator is being instantiated incorrectly. It should be used directly without callingignore()
. - Reason this comment was not posted:
Marked as duplicate.
4. hamilton/function_modifiers/macros.py:1373
- Draft comment:
Theignore
decorator is being instantiated incorrectly. It should be used directly without callingignore()
. - Reason this comment was not posted:
Marked as duplicate.
5. hamilton/function_modifiers/configuration.py:280
- Draft comment:
Theignore
method is being called as a static method of theignore
class, which is unnecessary and confusing. Consider refactoring to makeignore
a standalone function or a class method, but not both. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment points out a potential design issue where a static method is used to return an instance of the same class, which can be confusing. This is a valid point as it might lead to misunderstandings about the method's purpose. The suggestion to refactor it to either a standalone function or a class method is actionable and clear.
The comment assumes that the current design is confusing without considering if there might be a specific reason for this design choice. It also doesn't consider if the method is used elsewhere in a way that justifies its current form.
While there might be a reason for the current design, the comment highlights a potential improvement in code clarity, which is generally beneficial. The suggestion is clear and actionable, making it a valid comment to keep.
The comment is valid as it highlights a potential improvement in code clarity by suggesting a refactor of theignore
method. It is actionable and clear, so it should be kept.
Workflow ID: wflow_ngnsvBze9BWOOPMu
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
Looks good! Small nits. One thought -- is @ignore
(the name I suggested) the best name?
Other thoughts (would love your ideas):
@hamilton_ignore
@exclude
@hamilton_exclude
And another thought -- should we have an option in @mutate
and step
to not ignore them? E.G. is there any way we may want to also include it in the pipeline (instinct says no here...)
examples/mutate/abstract functionality blueprint/pipe_output.py
Outdated
Show resolved
Hide resolved
examples/mutate/abstract functionality blueprint/pipe_output_on_output.py
Outdated
Show resolved
Hide resolved
@@ -620,6 +620,8 @@ def step( | |||
they will be converted to a value (a literal) | |||
:return: an applicable with the function applied | |||
""" | |||
# This function will be excluded from the DAG as a node since we are inserting it manually | |||
fn = ignore()(fn) |
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.
So, thinking about this, I'm not sure we should be injecting this with step
-- to me this might be a parameter we want to pipe_output
.
The problem is we won't know whether a function is included until later (when it's referred), which feels harder to parse. So maybe remove this, or put this behind a default-off toggle?
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.
@skrawcz's made a good point about mixing functions and losing readability. Maybe it's better if we omit it for step
, pipe_*
and defer it to the user to do it? Then at least each function will have a decorator or "_" prefix and it is clear again
@mutate(data_2, missing_row=value(["c", 145])) | ||
def _add_missing_value(some_data: pd.DataFrame, missing_row: List[Any]) -> pd.DataFrame: |
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 is okay to not have _
from a API UX consistency view, only because we decorate it with a Hamilton thing -- so you will know that this turns into part of DAG for a node.
Having a look with fresh eyes I agree, we should make it explicit that it is for hamilton to avoid confusion. How about |
A decorator that lets you exclude functions from the DAG. - Enabled to be used by user - Useful for internal wiring to avoid changing function names and prefix them with underscores - Add hamilton_skip to mutate to always hide the helper function, leaving it up to the user for other decorators/functions to improve code readability
be0025a
to
ab8c6f9
Compare
Thoughts on naming:
Other nit:
|
I think it should be very specific that Hamilton is the one doing it -- so I'm in favor of That said, I don't think this should be the first way to do things (it should be with |
@@ -18,6 +18,7 @@ Note the following: | |||
|
|||
* ``@config`` If you're feeling adventurous, you can pass in a lambda function that takes in the entire configuration and resolves to ``True`` or ``False``. You probably don't want to do this. | |||
|
|||
* To always exclude a function (such as helper functions) from the DAG you can also use ``@hamilton_skip``. |
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.
Mention that we can use _
as a prefix (preferred) or @hamilton_skip
Looks good, let's just change the wording of the docs to indicate that |
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.
Looks good! Let's just change the wording to show that _
is preferred
The new name makes the functionality clearer.
5dcaf0b
to
b0c63c3
Compare
Solves #1168.
Changes
mutate
to automatically hide helper functions --> resolved a TODOHow I tested this
step
andmutate
)Checklist