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
Closes QS-002. The previous Python SDK quickstart assumed a running
server and used token="your-token" without explaining where either
came from, so a first-time pip install user hit a ConnectError on the
first run and had to bounce to /docs/2.0/server-setup to recover.
The quickstart now splits into two numbered steps:
1. Start a local server — a self-contained docker compose snippet with
APP_KEY generation and WORKFLOW_SERVER_AUTH_DRIVER=none, plus a
health-check wait loop. Links out to server-setup for production.
2. Run the Python worker — the worker snippet now uses token=None to
match the no-auth local dev server, and explains where to swap in
a real token.
The former "Running Against Docker Compose" section at the bottom
duplicated the quickstart; it's now a "Running Against a Shared Server"
section with the production/team pattern (base URL + token + namespace).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/sdks/python.md
+41-17Lines changed: 41 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ The SDK targets the same durable model as the PHP package — instance IDs, run
11
11
## Requirements
12
12
13
13
- Python 3.10 or later
14
-
-A running[Durable Workflow server](/docs/2.0/server-setup)
14
+
-Docker (for the local server used in this quickstart) or an existing[Durable Workflow server](/docs/2.0/server-setup)
15
15
16
16
## Installation
17
17
@@ -23,7 +23,33 @@ The SDK has a single runtime dependency: [httpx](https://www.python-httpx.org/).
23
23
24
24
## Quickstart
25
25
26
-
This example defines a workflow with one activity, starts it against a local server, and waits for the result.
26
+
The quickstart has two steps: start a local server, then run the Python worker against it.
27
+
28
+
### 1. Start a local server
29
+
30
+
The fastest path is the server's Docker Compose stack, which brings up the server plus its MySQL and Redis dependencies. The snippet below disables authentication for local development — do not use `WORKFLOW_SERVER_AUTH_DRIVER=none` in production.
until curl -sf http://localhost:8080/api/health > /dev/null;do sleep 1;done
45
+
echo"Server is ready."
46
+
```
47
+
48
+
For a full walkthrough — auth drivers, database config, production deployment — see the [server setup guide](/docs/2.0/server-setup).
49
+
50
+
### 2. Run the Python worker
51
+
52
+
This example defines a workflow with one activity, starts it against the local server, and waits for the result.
27
53
28
54
```python
29
55
import asyncio
@@ -40,7 +66,9 @@ class GreeterWorkflow:
40
66
return result
41
67
42
68
asyncdefmain():
43
-
asyncwith Client("http://localhost:8080", token="your-token") as client:
69
+
# token=None matches WORKFLOW_SERVER_AUTH_DRIVER=none in the server .env.
70
+
# If you set a token instead, pass token="your-token" here.
71
+
asyncwith Client("http://localhost:8080") as client:
44
72
handle =await client.start_workflow(
45
73
workflow_type="greeter",
46
74
task_queue="default",
@@ -550,22 +578,18 @@ This means Python workflows and activities can interoperate with PHP workers on
550
578
551
579
Avoid passing Python-specific types (dataclasses, sets, tuples, datetime objects) as workflow or activity inputs unless you explicitly convert them to JSON-compatible structures first.
552
580
553
-
## Running Against Docker Compose
554
-
555
-
The fastest way to get started is with the server's Docker Compose stack:
cp .env.example .env # set APP_KEY and WORKFLOW_SERVER_AUTH_TOKEN
562
-
docker compose up -d
583
+
The [Quickstart](#quickstart) above shows how to bring up a local server via Docker Compose. In a team environment you usually point the Python worker at an existing server (staging, production, or a shared dev instance):
563
584
564
-
# Install the Python SDK
565
-
pip install durable-workflow
585
+
```python
586
+
from durable_workflow import Client
566
587
567
-
# Run your Python worker
568
-
python my_worker.py
588
+
client = Client(
589
+
"https://workflow.example.internal",
590
+
token="shared-server-token",
591
+
namespace="team-orders",
592
+
)
569
593
```
570
594
571
-
The server runs on `http://localhost:8080` by default.
595
+
Set the `namespace` argument to whichever tenant namespace the shared server has provisioned for your team. The server operator manages namespace creation — see the [server setup guide](/docs/2.0/server-setup) for details.
0 commit comments