@@ -14,34 +14,14 @@ def noop_func(**kwargs):
1414 pass
1515
1616
17- @dataclass
18- class ActionSpec :
19- """A configured Action."""
20-
21- action : StrOrCallable
22- """A python path to a function or name of a built-in action."""
23-
24- id : Optional [str ] = None
25- """Identifier for the action."""
26-
27- comment : Optional [str ] = None
28- """A comment about what this action does."""
29-
30- args : list = field (default_factory = list )
31- """Arguments to instantiate the action."""
32-
33- kwargs : dict = field (default_factory = dict )
34- """Keyword arguments to instantiate the action."""
35-
36-
3717class Pipeline :
3818 """A collection of actions to perform on an input."""
3919
4020 actions : tuple
4121 """The actions to perform on the input."""
4222
4323 context : dict
44- """The current state of the pipeline."""
24+ """The current state of the pipeline initialized by keyword arguments ."""
4525
4626 def __init__ (
4727 self ,
@@ -64,6 +44,24 @@ def run(self, input_value: Optional[str] = None):
6444class Action :
6545 """An action to perform in a pipeline."""
6646
47+ _action_str : str
48+ """A python path to a function or name of a built-in action."""
49+
50+ id : Optional [str ] = None
51+ """Identifier for the action."""
52+
53+ _args : list
54+ """Arguments to instantiate the action."""
55+
56+ _kwargs : dict
57+ """Keyword arguments to instantiate the action."""
58+
59+ commit_metadata_func : Optional [Callable ]
60+ """Function the action can call to set metadata about the commit."""
61+
62+ version_metadata_func : Optional [Callable ]
63+ """Function the action can call to set metadata about the version a commit belongs to."""
64+
6765 def __init__ (
6866 self ,
6967 action : str ,
@@ -133,16 +131,15 @@ def pipeline_factory(
133131 ** kwargs ,
134132) -> Pipeline :
135133 """Create a Pipeline from a list of configured actions."""
136- action_specs = [ActionSpec (** action ) for action in action_list ]
137134 actions = [
138135 Action (
139- action = a . action ,
140- id_ = a .id ,
141- args = a .args ,
142- kwargs = a .kwargs ,
136+ action = a [ " action" ] ,
137+ id_ = a .get ( "id" ) ,
138+ args = a .get ( " args" ) ,
139+ kwargs = a .get ( " kwargs" ) ,
143140 commit_metadata_func = commit_metadata_func ,
144141 version_metadata_func = version_metadata_func ,
145142 )
146- for a in action_specs
143+ for a in action_list
147144 ]
148145 return Pipeline (actions = actions , ** kwargs )
0 commit comments