-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…1358) Signed-off-by: tdruez <[email protected]>
- Loading branch information
Showing
18 changed files
with
378 additions
and
213 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# `aboutcode.pipeline` | ||
|
||
Define and run pipelines. | ||
|
||
### Install | ||
|
||
```bash | ||
pip install aboutcode_pipeline | ||
``` | ||
|
||
### Define and execute a pipeline | ||
|
||
```python | ||
from aboutcode.pipeline import BasePipeline | ||
|
||
class PrintMessages(BasePipeline): | ||
@classmethod | ||
def steps(cls): | ||
return (cls.step1,) | ||
|
||
def step1(self): | ||
print("Message from step1") | ||
|
||
PrintMessages().execute() | ||
``` | ||
|
||
### Groups and steps selection | ||
|
||
```python | ||
from aboutcode.pipeline import BasePipeline | ||
from aboutcode.pipeline import group | ||
|
||
class PrintMessages(BasePipeline): | ||
@classmethod | ||
def steps(cls): | ||
return (cls.step1, cls.step2) | ||
|
||
def step1(self): | ||
print("Message from step1") | ||
|
||
@group("foo") | ||
def step2(self): | ||
print("Message from step2") | ||
|
||
|
||
# Execute pipeline with group selection | ||
run = PrintMessages(selected_groups=["foo"]) | ||
exitcode, error = run.execute() | ||
|
||
# Execute pipeline with steps selection | ||
run = PrintMessages(selected_steps=["step1"]) | ||
exitcode, error = run.execute() | ||
``` |
This file contains 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
Oops, something went wrong.