Skip to main content

Python SDK for the Stitch workflow execution engine

Project description

stitch-sdk

Python SDK for the Stitch workflow execution engine.

Install

pip install stitch-sdk

Usage

import stitch

@stitch.task(max_attempts=5)
def charge_payment(order_id, amount):
    return {"txn_id": "txn_123"}

@stitch.task
def send_email(email, order_id):
    return {"sent": True}

@stitch.workflow
def process_order(input):
    charge_payment(order_id=input["order_id"], amount=input["amount"])
    send_email(email=input["email"], order_id=input["order_id"])

# Submit and wait
client = stitch.Client("http://localhost:8080")
result = client.run(process_order, input={
    "order_id": "ORD-001",
    "amount": 9897,
    "email": "user@example.com",
}).wait()

print(result.status)  # → "completed"
print(result.output)  # → {'charge_payment': {'txn_id': 'txn_123'}, 'send_email': {'sent': True}}

Worker

worker = stitch.Worker(client, tasks=[charge_payment, send_email])
worker.start()  # blocks, polls for tasks, executes them

Requirements

  • Python ≥ 3.9
  • A running Stitch engine (or use the embedded zero-config mode)

License

MIT

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.0.tar.gz (38.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stitch_eng_sdk-0.2.0-py3-none-any.whl (38.6 MB view details)

Uploaded Python 3

File details

Details for the file stitch_eng_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: stitch_eng_sdk-0.2.0.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

Hashes for stitch_eng_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6f0d5104aed6e6ebdf7b424af629874b38a24239ff938a49a8ecf652e2cdf9f0
MD5 486f84e3abe2e617571e38bdebe8d6ae
BLAKE2b-256 e3ce8cd31513f13eb0f65b2052d675b6e6b2a5737b316b8810e8e6b6b048cacc

See more details on using hashes here.

File details

Details for the file stitch_eng_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: stitch_eng_sdk-0.2.0-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

Hashes for stitch_eng_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3322b8e00a5fdf2fbff4bb36b2de9015a638b91804f026fa0e14b02faae596de
MD5 51a48faa6e945fb499b58e560ce7c8c9
BLAKE2b-256 51db2696e77636e100587878f23d2d2b0b7ea0e8545e3a18c9f44f88aa3500f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page