Is there any appetite for this <issue> from the Me...
# dev-metaflow
m
Is there any appetite for this issue from the Metaflow side? From my side at least, it seems like a good idea. I find myself frequently repeating the same environment decorator on each step of a workflow. Would be much nicer if I could just specify it on a flow level.
2
f
yeah we have had similar experience too where we wrote some custom decorator and wanted to apply it to all the steps.
c
We have worked around this issue by creating a
@decorate_all_steps(decorators...)
flow decorator. Would be nice to have it solved natively
m
Yeah, I would prefer it to be native too, if that were possible. How did you implement your
decorate_all_steps
approach? You use the
_attach_decorators
method?
c
It's actually not a metaflow decorator at all, just a plain python class decorator that essentially does:
Copy code
methods = [
    attr
    for attr in cls.__dict__
    if callable(getattr(cls, attr)) and getattr(getattr(cls, attr), "is_step", False)
]
for method in methods:
    for decorator in decorators:
        setattr(cls, method, decorator(getattr(cls, method)))
👍 1
s
+1 we have been thinking of looking into this at some point too - in the context of
@conda
and
@pypi
decorators
@dry-beach-38304 @bulky-afternoon-92433 for viz ^