Skip to main content

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

flowwatch_client-3.0.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

flowwatch_client-3.0.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file flowwatch_client-3.0.0.tar.gz.

File metadata

  • Download URL: flowwatch_client-3.0.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for flowwatch_client-3.0.0.tar.gz
Algorithm Hash digest
SHA256 1385d8c024905512ef851e1812fb07be406f5e88d8fa7c8fc609008f9b4f07f8
MD5 daf0115be7e341eea4cd71169f984a6d
BLAKE2b-256 5770dc5073ef5b513c2621477735155710f9a5f28e34a767168fd49ef576df0f

See more details on using hashes here.

File details

Details for the file flowwatch_client-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flowwatch_client-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bedf6de4a2c702440205bcc9556e3f4bfe57c52948610546ff129aaaea7c85c
MD5 f7ae7eeb8be339ff399196e8f806d070
BLAKE2b-256 a8400a880ce83b783f2514c8ec6f838af4079542f851edc1006117ceb918a28a

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