Python SDK for the Stitch workflow execution engine
Project description
stitch-eng-sdk
Python SDK for the Stitch workflow execution engine.
Install
pip install stitch-eng-sdk
Quickstart (Embedded Zero-Config Mode)
Stitch comes with an embedded Go binary so you don't even need to start a server locally!
import threading
import stitch
@stitch.task(max_attempts=5)
def charge_payment(order_id, amount):
return {"txn_id": "txn_123"}
@stitch.task
def send_email(email, txn_id):
return {"sent": True}
@stitch.workflow
def process_order(inp):
# Pass the output of one task directly to the next to create a dependency!
payment = charge_payment(order_id=inp["order_id"], amount=inp["amount"])
send_email(email=inp["email"], txn_id=payment["txn_id"])
# 1. Start the embedded server and client
client = stitch.Client()
# 2. Start a background worker to poll for tasks
worker = stitch.Worker(client, tasks=[charge_payment, send_email])
threading.Thread(target=worker.start, daemon=True).start()
# 3. Submit the workflow and wait for it to finish!
result = client.run(process_order, input={
"order_id": "ORD-001",
"amount": 9897,
"email": "user@example.com",
}).wait()
print(result.status) # → "completed"
worker.stop()
client.close()
Remote Servers
If you have a remote production server, you can pass the URL and an API key:
client = stitch.Client("https://stitch.mycompany.com", api_key="sk_secret")
Requirements
- Python ≥ 3.9
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stitch_eng_sdk-0.2.2.tar.gz
(38.1 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stitch_eng_sdk-0.2.2.tar.gz.
File metadata
- Download URL: stitch_eng_sdk-0.2.2.tar.gz
- Upload date:
- Size: 38.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c88a8608e059dddc288b0a9534fe1ef8dec0565ed0d7e0d4c5f9bd0b6b166575
|
|
| MD5 |
8cb35022daabe1611287513525100d0f
|
|
| BLAKE2b-256 |
958920524cbd662e07a2eadd1ba12038347f54e29e4c27512e18626946bf1f06
|
File details
Details for the file stitch_eng_sdk-0.2.2-py3-none-any.whl.
File metadata
- Download URL: stitch_eng_sdk-0.2.2-py3-none-any.whl
- Upload date:
- Size: 38.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1077351e5b7daee36e1b458f19ccdac59456a198d85169286fd7e93416b5dc3
|
|
| MD5 |
b2899309bfd616536e6e5e7ae0c5b973
|
|
| BLAKE2b-256 |
2d9914b1377ce46050eba32df1857e2b158042c912cb00c465e19b544bee2d7f
|