Python client SDK for FlowWatch — feature flags, durable workflows, tracing, and error capture
Project description
flowwatch-client (Python)
Python client SDK for FlowWatch — feature flags, durable workflows, request tracing, and error capture.
This SDK talks to a lightweight sidecar HTTP server that you run alongside your Node.js FlowWatch app. See the full documentation for setup instructions.
Installation
pip install flowwatch-client
Prerequisites
You need the Node.js FlowWatch package running with the sidecar enabled:
npm i @pranshulsoni/flowwatch
import { createFlowwatch, startSidecar } from "@pranshulsoni/flowwatch";
const fw = await createFlowwatch({ db: { connectionString: process.env.DATABASE_URL } });
startSidecar(fw, { port: 9400, token: process.env.SIDECAR_TOKEN });
Usage
from flowwatch import FlowwatchClient
client = FlowwatchClient("http://localhost:9400", token="your-token")
# Feature flag
if client.evaluate_flag("new-checkout", {"userId": "user_123"}):
render_new_ui()
# Trigger a workflow
client.trigger_workflow("send-order", {"orderId": "ord_456", "amount": 4999})
# Capture an error
try:
do_something_risky()
except Exception as e:
import traceback
client.capture_error(str(e), stack=traceback.format_exc(), source="worker")
# Auto-timed trace span (context manager)
with client.trace_span("db-query", type="db"):
rows = db.execute("SELECT * FROM products")
# Health check
status = client.health()
client.close()
Async support
Use FlowwatchAsyncClient for async codebases (FastAPI, asyncio):
from flowwatch import FlowwatchAsyncClient
async def handler():
async with FlowwatchAsyncClient("http://localhost:9400", token="your-token") as client:
enabled = await client.evaluate_flag("new-checkout", {"userId": "user_123"})
License
ISC
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
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 flowwatch_client-3.0.1.tar.gz.
File metadata
- Download URL: flowwatch_client-3.0.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9e4a58843f79fdba25e34fa34f04c1d61dcdb23ad81673c147b29b4e611b48d
|
|
| MD5 |
89797484f01f8ac19cdd1c6a96ef41c7
|
|
| BLAKE2b-256 |
38d303c5489dcf16284d3de792f0bdb4abf3bc1dede6359714fba91c49eccb65
|
File details
Details for the file flowwatch_client-3.0.1-py3-none-any.whl.
File metadata
- Download URL: flowwatch_client-3.0.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c05100060466115c09db8fb1027ccd7c88d8a558a37067e15e43d296adde03a9
|
|
| MD5 |
5d43accf26d25003b0d728445e363e6a
|
|
| BLAKE2b-256 |
4f6666c1b68b447f8a747dff8b3d7545d5a3a6ce2a7bf3abcb6cad6e7fa83354
|