@@ -13,68 +13,121 @@ You can schedule two scenarios of the workflow.
13
13
- Poetry (for dependency management)
14
14
- Docker (for running the Restack services)
15
15
16
- ## Usage
16
+ ## Start Restack
17
17
18
- 1 . Run Restack local engine with Docker:
18
+ To start the Restack, use the following Docker command :
19
19
20
- ``` bash
21
- docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:7233 ghcr.io/restackio/restack:main
22
- ```
20
+ ``` bash
21
+ docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:7233 ghcr.io/restackio/restack:main
22
+ ```
23
23
24
- 2 . Open the web UI to see the workflows:
24
+ ## Environment variables
25
25
26
- ``` bash
27
- http://localhost:5233
28
- ```
26
+ Create .env file with: STRIPE_SECRET_KEY and OPENAI_API_KEY
29
27
30
- 3 . Clone this repository:
31
28
32
- ``` bash
33
- git clone https://github.com/restackio/examples-python
34
- cd examples-python/examples/get-started
35
- ```
36
-
37
- 4 . Create .env file with: STRIPE_SECRET_KEY and OPENAI_API_KEY
29
+ ## Start python shell
38
30
39
- 4 . Install dependencies using Poetry :
31
+ If using uv :
40
32
41
- ``` bash
42
- poetry env use 3.12
43
- ```
33
+ ``` bash
34
+ uv venv && source .venv/bin/activate
35
+ ```
44
36
45
- ``` bash
46
- poetry shell
47
- ```
37
+ If using poetry:
48
38
49
- ``` bash
50
- poetry install
51
- ```
39
+ ``` bash
40
+ poetry env use 3.12 && poetry shell
41
+ ```
52
42
53
- ``` bash
54
- poetry env info # Optional: copy the interpreter path to use in your IDE (e.g. Cursor, VSCode, etc.)
55
- ```
43
+ If using pip:
56
44
57
- 5 . Run the services:
45
+ ``` bash
46
+ python -m venv .venv && source .venv/bin/activate
47
+ ```
58
48
59
- ``` bash
60
- poetry run services
61
- ```
49
+ ## Install dependencies
62
50
63
- This will start the Restack service with the defined workflows and functions.
51
+ If using uv:
64
52
65
- 6 . In a new terminal, schedule the workflow:
53
+ ``` bash
54
+ uv sync
55
+ uv run dev
56
+ ```
66
57
67
- ``` bash
68
- poetry shell
69
- ```
58
+ If using poetry:
70
59
71
- ``` bash
72
- poetry run schedule
73
- ```
60
+ ``` bash
61
+ poetry install
62
+ poetry run dev
63
+ ```
64
+
65
+ If using pip:
66
+
67
+ ``` bash
68
+ pip install -e .
69
+ python -c " from src.services import watch_services; watch_services()"
70
+ ```
71
+
72
+
73
+ ## Run the services:
74
+
75
+ If using uv:
76
+
77
+ ``` bash
78
+ uv run services
79
+ ```
80
+
81
+ If using poetry:
82
+
83
+ ``` bash
84
+ poetry run services
85
+ ```
86
+
87
+ If using pip:
88
+
89
+ ``` bash
90
+ python -c " from src.services import run_services; run_services()"
91
+ ```
92
+
93
+ ## In a new terminal, schedule the workflow:
94
+
95
+ If using uv:
96
+
97
+ ``` bash
98
+ uv run schedule
99
+ ```
100
+
101
+ If using poetry:
102
+
103
+ ``` bash
104
+ poetry run schedule
105
+ ```
106
+
107
+ If using pip:
108
+
109
+ ``` bash
110
+ python -c " from schedule_workflow import run_schedule_workflow; run_schedule_workflow()"
111
+ ```
74
112
75
113
This will schedule the ` SendEmailWorkflow ` and print the result.
76
114
77
- 7 . To simulate a flow where the step for sending email fails and the retry is automatically handled by Restack AI use run:
78
- ``` bash
79
- poetry run schedule_failure
80
- ```
115
+ ### To simulate a flow where the step for sending email fails and the retry is automatically handled by Restack AI use run:
116
+
117
+ If using uv:
118
+
119
+ ``` bash
120
+ uv run schedule_failure
121
+ ```
122
+
123
+ If using poetry:
124
+
125
+ ``` bash
126
+ poetry run schedule_failure
127
+ ```
128
+
129
+ If using pip:
130
+
131
+ ``` bash
132
+ python -c " from schedule_workflow_failure import run_schedule_workflow_failure; run_schedule_workflow_failure()"
133
+ ```
0 commit comments