OpenFeature Provider for Python SDK
Integrate OpenFeature with Harness FME in your Python applications to evaluate feature flags, manage contexts, and track events using a standardized SDK.
Integrate your Python applications with Harness FME using the Python OpenFeature Provider, a standardized, vendor-agnostic feature flagging API. This provider implements the OpenFeature specification and bridges the OpenFeature SDK with the Harness FME Python SDK.
This page walks you through installing, configuring, and using the Python OpenFeature provider to evaluate feature flags in your Python applications.
Before you begin
Before you begin, ensure you have the following:
A valid Harness FME SDK key for your project
Python 3.9 or later
Access to
pipto install dependencies
Version compatibility
Python
3.9 +
@splitsoftware/split-openfeature-provider
≥ 1.0.0
OpenFeature Python SDK
≥ 0.8.1
Install the provider and dependencies
Install the Harness FME OpenFeature provider using pip:
pip install split-openfeature-provider==1.0.0Configure the provider
You can register the provider with OpenFeature in one of several ways, depending on your setup.
This example demonstrates how to use the SplitProvider:
If you want access to additional initialization options, you can provide a Split client to the constructor:
Construct an evaluation context
Provide an evaluation context with a targeting key to evaluate flags. The evaluation context passes targeting information such as user IDs, email addresses, or plan types for flag targeting.
For example:
If the same targeting key is reused across evaluations, set the context at the client level:
Or at the API level:
Once the context is set at the client or API level, you don't need to provide it for each evaluation.
Asyncio mode
The Harness FME OpenFeature provider also supports asyncio mode.
For example:
To create a Split client externally for asyncio:
For asyncio flag evaluation:
Logging
The Harness FME OpenFeature provider uses Python's logging library.
For example, this code sample sets all libraries using logging (including the provider itself) to use DEBUG mode:
Shutting down the Split SDK factory
Before terminating the OpenFeature object, ensure the internal Split client shuts down properly.
For example:
For asyncio mode:
For more information, go to the Harness FME Python OpenFeature Provider GitHub repository.
Last updated
Was this helpful?