The `openfeature-provider-flagsmith` library provides an OpenFeature-compliant provider for Flagsmith. It allows applications to integrate Flagsmith's feature flag capabilities using the OpenFeature SDK, abstracting the underlying feature flagging system. The current version is 0.1.6, with releases typically tied to updates in OpenFeature SDK or Flagsmith SDK, or feature enhancements.
pip install openfeature-provider-flagsmithVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `FlagsmithProvider` with your Flagsmith Environment Key, register it with the OpenFeature API, and then use the OpenFeature client to evaluate boolean and string feature flags. Ensure your `FLAGSMITH_ENVIRONMENT_KEY` is set as an environment variable.
Always provide your Flagsmith Environment Key during `FlagsmithProvider` instantiation: `FlagsmithProvider(environment_key="YOUR_KEY")`.
Ensure your application has stable network access to the Flagsmith API. Check your Flagsmith project configuration and API status if you encounter network-related errors. Consider using `OpenFeatureAPI.set_default_value` for robust fallback behavior.
Always provide a sensible and safe default value that ensures your application can function even if the feature flag cannot be resolved correctly. E.g., `client.get_boolean_value("my_flag", False)`.Strictly adhere to the `flagsmith` SDK version range specified by `openfeature-provider-flagsmith`'s `install_requires`. Upgrade `openfeature-provider-flagsmith` if you need to use a newer `flagsmith` SDK version.