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.2.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.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flowwatch_client-3.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 62e090dce89d02cc5f43c845fa994be6da2e52018287e59b43de598b5390a6a4
MD5 7338043db4809b3832229dea09d19aaa
BLAKE2b-256 fb0f03fe165fd2340514f80f726c670273547e8a130bc2a2266a429ac449e98b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flowwatch_client-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e43a79b25e72f9d8713a79deeaf3e4324404e4ada929ac73c498f65feff30452
MD5 d675a0197dfa0296a714255fb88fb26f
BLAKE2b-256 d3723805b894ab1fe00654c836a2ecf9412fb70efe2885a310ed6234cba12508

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