You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Import the activity and workflow from our other files
165
+
from .activities import say_hello
166
+
from .workflows import SayHello
148
167
149
168
asyncdefmain():
150
169
# Create client connected to server at the given address
@@ -172,7 +191,7 @@ import asyncio
172
191
from temporalio.client import Client
173
192
174
193
# Import the workflow from the previous code
175
-
fromrun_workerimport SayHello
194
+
from.workflowsimport SayHello
176
195
177
196
asyncdefmain():
178
197
# Create client connected to server at the given address
@@ -196,11 +215,16 @@ The output will be:
196
215
Result: Hello, my-name!
197
216
198
217
## Next Steps
199
-
Temporal can be implemented in your code in many different ways, to suit your application's needs. The links below will give you much more information about how Temporal works with Python:
200
218
201
-
*[Code Samples](https://github.com/temporalio/samples-python) - If you want to start with some code, we have provided some pre-built samples.
202
-
*[Application Development Guide](https://docs.temporal.io/application-development?lang=python) Our Python specific Developer's Guide will give you much more information on how to build with Temporal in your Python applications than our SDK README ever could (or should).
203
-
*[API Documentation](https://python.temporal.io) - Full Temporal Python SDK package documentation
219
+
Temporal can be implemented in your code in many different ways, to suit your application's needs. The links below will
220
+
give you much more information about how Temporal works with Python:
221
+
222
+
*[Code Samples](https://github.com/temporalio/samples-python) - If you want to start with some code, we have provided
223
+
some pre-built samples.
224
+
*[Application Development Guide](https://docs.temporal.io/application-development?lang=python) Our Python specific
225
+
Developer's Guide will give you much more information on how to build with Temporal in your Python applications than
226
+
our SDK README ever could (or should).
227
+
*[API Documentation](https://python.temporal.io) - Full Temporal Python SDK package documentation.
204
228
205
229
---
206
230
@@ -420,16 +444,12 @@ respectively. Here's an example of a workflow:
420
444
421
445
```python
422
446
import asyncio
423
-
from dataclasses import dataclass
424
447
from datetime import timedelta
425
-
from temporalio import activity, workflow
426
-
from temporalio.client import Client
427
-
from temporalio.worker import Worker
448
+
from temporalio import workflow
428
449
429
-
@dataclass
430
-
classGreetingInfo:
431
-
salutation: str="Hello"
432
-
name: str="<unknown>"
450
+
# Pass the activities through the sandbox
451
+
with workflow.unsafe.imports_passed_through():
452
+
from .my_activities import GreetingInfo, create_greeting_activity
433
453
434
454
@workflow.defn
435
455
classGreetingWorkflow:
@@ -477,16 +497,31 @@ class GreetingWorkflow:
477
497
asyncdefcurrent_greeting(self) -> str:
478
498
returnself._current_greeting
479
499
500
+
```
501
+
502
+
This assumes there's an activity in `my_activities.py` like:
0 commit comments