1
1
# Temporal Python SDK
2
2
3
- ** UNDER DEVELOPMENT**
3
+ [ ![ Python 3.7+] ( https://img.shields.io/pypi/pyversions/temporalio.svg?style=for-the-badge )] ( https://pypi.org/project/temporalio )
4
+ [ ![ PyPI] ( https://img.shields.io/pypi/v/temporalio.svg?style=for-the-badge )] ( https://pypi.org/project/temporalio )
5
+ [ ![ MIT] ( https://img.shields.io/pypi/l/temporalio.svg?style=for-the-badge )] ( LICENSE )
6
+
7
+ [ Temporal] ( https://temporal.io/ ) is a distributed, scalable, durable, and highly available orchestration engine used to
8
+ execute asynchronous long-running business logic in a scalable and resilient way.
9
+
10
+ "Temporal Python SDK" is the framework for authoring workflows and activities using the Python programming language.
11
+
12
+ In addition to this documentation, see the [ samples] ( https://github.com/temporalio/samples-python ) repository for code
13
+ examples.
14
+
15
+ ** ⚠️ UNDER DEVELOPMENT**
4
16
5
17
The Python SDK is under development. There are no compatibility guarantees nor proper documentation pages at this time.
6
18
7
- ## Usage
19
+ Currently missing features:
20
+
21
+ * Workflow worker support
22
+ * Async activity support (in client or worker)
23
+ * Support for Windows arm, macOS arm (i.e. M1), Linux arm, and Linux x64 glibc < 2.31.
24
+
25
+ ## Quick Start
8
26
9
27
### Installation
10
28
11
- Install the ` temporalio ` package from [ PyPI] ( https://pypi.org/project/temporalio ) . If using ` pip ` directly, this might
12
- look like:
29
+ Install the ` temporalio ` package from [ PyPI] ( https://pypi.org/project/temporalio ) .
30
+
31
+ These steps can be followed to use with a virtual environment and ` pip ` :
32
+
33
+ * [ Create a virtual environment] ( https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments )
34
+ * Update ` pip ` - ` python -m pip install -U pip `
35
+ * Needed because older versions of ` pip ` may not pick the right wheel
36
+ * Install Temporal SDK - ` python -m pip install temporalio `
37
+
38
+ The SDK is now ready for use.
39
+
40
+ ### Starting a Workflow
41
+
42
+ Create the following script at ` start_workflow.py ` :
43
+
44
+ ``` python
45
+ import asyncio
46
+ from temporalio.client import Client
47
+
48
+ async def main ():
49
+ # Create client connected to server at the given address
50
+ client = await Client.connect(" http://localhost:7233" )
51
+
52
+ # Start a workflow
53
+ handle = await client.start_workflow(" my workflow name" , " some arg" , id = " my-workflow-id" , task_queue = " my-task-queue" )
13
54
14
- python -m pip install temporalio
55
+ print (f " Workflow started with ID { handle.id} " )
56
+
57
+ if __name__ == " __main__" :
58
+ asyncio.run(main())
59
+ ```
60
+
61
+ Assuming you have a [ Temporal server running on localhost] ( https://docs.temporal.io/docs/server/quick-install/ ) , this
62
+ will start a workflow:
63
+
64
+ python start_workflow.py
65
+
66
+ Note that an external worker has to be started with this workflow registered to actually run the workflow.
67
+
68
+ ## Usage
15
69
16
70
### Client
17
71
@@ -21,7 +75,7 @@ A client can be created and used to start a workflow like so:
21
75
from temporalio.client import Client
22
76
23
77
async def main ():
24
- # Create client connected to server at the given address
78
+ # Create client connected to server at the given address and namespace
25
79
client = await Client.connect(" http://localhost:7233" , namespace = " my-namespace" )
26
80
27
81
# Start a workflow
0 commit comments