Skip to main content

Python client SDK for FlowWatch — feature flags, durable workflows, tracing, and error capture

Project description

flowwatch-client (Python)

PyPI version Monthly downloads License Python versions

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.1.tar.gz (3.2 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.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

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

Hashes for flowwatch_client-3.0.1.tar.gz
Algorithm Hash digest
SHA256 b9e4a58843f79fdba25e34fa34f04c1d61dcdb23ad81673c147b29b4e611b48d
MD5 89797484f01f8ac19cdd1c6a96ef41c7
BLAKE2b-256 38d303c5489dcf16284d3de792f0bdb4abf3bc1dede6359714fba91c49eccb65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flowwatch_client-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c05100060466115c09db8fb1027ccd7c88d8a558a37067e15e43d296adde03a9
MD5 5d43accf26d25003b0d728445e363e6a
BLAKE2b-256 4f6666c1b68b447f8a747dff8b3d7545d5a3a6ce2a7bf3abcb6cad6e7fa83354

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