Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion references/python/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def greet(name: str) -> str:
```python
from datetime import timedelta
from temporalio import workflow
from temporalio.common import RetryPolicy

with workflow.unsafe.imports_passed_through():
from activities.greet import greet
Expand All @@ -32,10 +33,15 @@ class GreetingWorkflow:
@workflow.run
async def run(self, name: str) -> str:
return await workflow.execute_activity(
greet, name, start_to_close_timeout=timedelta(seconds=30)
greet,
name,
start_to_close_timeout=timedelta(seconds=30),
retry_policy=RetryPolicy(maximum_attempts=3),
)
```

Note the import paths: `workflow` (decorators, `execute_activity`, `logger`, etc.) lives in `temporalio.workflow`, but configuration types like `RetryPolicy` live in `temporalio.common` — not on the `workflow` module. The same applies to `SearchAttributeKey`, `VersioningBehavior`, and similar types.

**worker.py** - Worker setup (registers activity and workflow, runs indefinitely and processes tasks):

```python
Expand Down