The `harness-featureflags` library provides the Python server SDK for Harness Feature Flags. It allows developers to integrate feature flag management into their Python applications, enabling dynamic control over features without redeploying code. The library is actively maintained, with frequent patch and minor releases, and is currently at version 1.7.5.
pip install harness-featureflagsVerified import paths — ran on the pinned version, not inferred.
This quickstart code demonstrates how to initialize the Harness Feature Flags Python SDK, define a target, and evaluate boolean and string feature flags. It continuously checks flag variations and prints their status until interrupted. Remember to replace `FF_API_KEY` with your actual Server SDK Key and update flag identifiers as needed. The SDK handles connection, caching, and updates automatically.
Upgrade to `harness-featureflags` version 1.6.4 or later using `pip install --upgrade harness-featureflags`.
Double-check your `API_KEY` against the one provided in the Harness Platform. Ensure your application's environment has outbound network access to the Harness configuration URL. Listen for the `Event.FAILED` event during SDK initialization for more detailed error information.
Design your application with robust fallback logic using the default values in `variation` calls. For advanced control, you can configure streaming/polling behavior and HTTP client options (e.g., via `with_httpx_args` introduced in v1.7.0) to suit your environment's needs, such as disabling streaming for consistent session flags if updates are not required.