0
# Pipeline System
1
2
Workflow pipeline system for building multi-step interactive applications with directed graph navigation. Enables complex multi-stage data processing workflows, wizards, and guided user experiences.
3
4
## Capabilities
5
6
### Pipeline Management
7
8
Core classes for defining and managing workflow pipelines with multiple stages and navigation.
9
10
```python { .api }
11
class Pipeline:
12
"""
13
Directed graph of workflow stages for building multi-step applications.
14
15
A Pipeline represents a UI workflow of multiple linear or branching stages,
16
where each stage returns a Panel object to render.
17
18
Parameters:
19
- stages: Dictionary mapping stage names to stage functions or objects
20
- start: Name of the starting stage
21
- debug: Whether to show debugging information
22
- sizing_mode: How the pipeline should size itself
23
- **params: Additional parameters
24
25
Layout Components:
26
- header: Pipeline header with navigation controls
27
- title: Name of the current stage
28
- error: Error display field
29
- network: Network diagram of the pipeline graph
30
- buttons: Navigation buttons and selectors
31
- prev_button: Button to go to previous stage
32
- prev_selector: Selector for branching previous stages
33
- next_button: Button to go to next stage
34
- next_selector: Selector for branching next stages
35
"""
36
37
class PipelineError:
38
"""
39
Custom error type for displaying pipeline-specific error messages.
40
41
Raised within pipeline stages to display custom error messages
42
in the pipeline's error display area.
43
"""
44
```
45
46
## Usage Examples
47
48
### Basic Linear Pipeline
49
50
```python
51
import panel as pn
52
53
def stage1():
54
return pn.Column(
55
"# Stage 1: Data Input",
56
pn.widgets.FileInput(accept='.csv'),
57
pn.widgets.Button(name="Next", button_type="primary")
58
)
59
60
def stage2():
61
return pn.Column(
62
"# Stage 2: Data Processing",
63
pn.pane.Markdown("Processing your data..."),
64
pn.widgets.Button(name="Next", button_type="primary")
65
)
66
67
def stage3():
68
return pn.Column(
69
"# Stage 3: Results",
70
pn.pane.Markdown("Your results are ready!"),
71
pn.widgets.Button(name="Download", button_type="success")
72
)
73
74
# Create linear pipeline
75
pipeline = pn.pipeline.Pipeline({
76
'input': stage1,
77
'process': stage2,
78
'results': stage3
79
}, start='input')
80
81
pipeline.servable()
82
```
83
84
### Branching Pipeline
85
86
```python
87
import panel as pn
88
89
def analysis_choice():
90
return pn.Column(
91
"# Choose Analysis Type",
92
pn.widgets.RadioButtonGroup(
93
name="Analysis",
94
options=['Statistical', 'Machine Learning', 'Visualization'],
95
value='Statistical'
96
)
97
)
98
99
def statistical_analysis():
100
return pn.pane.Markdown("# Statistical Analysis Results")
101
102
def ml_analysis():
103
return pn.pane.Markdown("# Machine Learning Results")
104
105
def visualization():
106
return pn.pane.Markdown("# Data Visualization")
107
108
# Create branching pipeline
109
pipeline = pn.pipeline.Pipeline({
110
'choice': (analysis_choice, ['stats', 'ml', 'viz']),
111
'stats': statistical_analysis,
112
'ml': ml_analysis,
113
'viz': visualization
114
}, start='choice')
115
```
116
117
The pipeline system is essential for building complex multi-step applications, data processing workflows, configuration wizards, and any application requiring guided user experiences with branching logic.