Package: launchdarkly-openfeature-server
LaunchDarkly OpenFeature provider for the Server-Side SDK for PythonThis provider allows for using LaunchDarkly with the OpenFeature SDK for Python.This provider is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.This provider is a beta version and should not be considered ready for production use while this message is visible.LaunchDarkly overviewLaunchDarklyis a feature management platform that serves trillions of feature flags daily to help teams build better software, faster.Get startedusing LaunchDarkly today!Supported Python versionsThis version of the LaunchDarkly provider works with Python 3.8 and above.Getting startedRequisitesInstall the library via pip$pipinstalllaunchdarkly-openfeature-serverUsagefromldclientimportConfig,LDClientfromld_openfeatureimportLaunchDarklyProviderfromopenfeature.evaluation_contextimportEvaluationContextfromopenfeatureimportapild_client=LDClient(config=Config("sdk-key"))openfeature_provider=LaunchDarklyProvider(ld_client)api.set_provider(openfeature_provider)# Refer to OpenFeature documentation for getting a client and performing evaluations.Refer to theSDK reference guidefor instructions on getting started with using the SDK.For information on using the OpenFeature client please refer to theOpenFeature Documentation.OpenFeature Specific ConsiderationsLaunchDarkly evaluates contexts, and it can either evaluate a single-context, or a multi-context. When using OpenFeature both single and multi-contexts must be encoded into a singleEvaluationContext. This is accomplished by looking for an attribute namedkindin theEvaluationContext.There are 4 different scenarios related to thekind:There is nokindattribute. In this case the provider will treat the context as a single context containing a "user" kind.There is akindattribute, and the value of that attribute is "multi". This will indicate to the provider that the context is a multi-context.There is akindattribute, and the value of that attribute is a string other than "multi". This will indicate to the provider a single context of the kind specified.There is akindattribute, and the attribute is not a string. In this case the value of the attribute will be discarded, and the context will be treated as a "user". An error message will be logged.Thekindattribute should be a string containing only contain ASCII letters, numbers,.,_or-.The OpenFeature specification allows for an optional targeting key, but LaunchDarkly requires a key for evaluation. A targeting key must be specified for each context being evaluated. It may be specified using eithertargetingKey, as it is in the OpenFeature specification, orkey, which is the typical LaunchDarkly identifier for the targeting key. If atargetingKeyand akeyare specified, then thetargetingKeywill take precedence.There are several other attributes which have special functionality within a single or multi-context.A key ofprivateAttributes. Must be an array of string values.Equivalent to the 'private' builder method in the SDK.A key ofanonymous. Must be a boolean value.Equivalent to the 'anonymous' builder method in the SDK.A key ofname. Must be a string.Equivalent to the 'name' builder method in the SDK.ExamplesA single user contextcontext=EvaluationContext("the-key")A single context of kind "organization"context=EvaluationContext("org-key",{"kind":"organization"});A multi-context containing a "user" and an "organization"attributes={"kind":"multi","organization":{"name":"the-org-name","targetingKey","my-org-key","myCustomAttribute","myAttributeValue"},"user":{"key":"my-user-key","anonymous",true}}context=EvaluationContext(null,attributes)Setting private attributes in a single contextattributes={"kind":"organization","myCustomAttribute":"myAttributeValue","privateAttributes":["myCustomAttribute"]}context=EvaluationContext("org-key",attributes)Setting private attributes in a multi-contextattributes={"kind":"organization","organization":{"name":"the-org-name","targetingKey":"my-org-key",# This will ONLY apply to the "organization" attributes."privateAttributes":["myCustomAttribute"],# This attribute will be private."myCustomAttribute":"myAttributeValue",},"user":["key":"my-user-key","anonymous"=>true,# This attribute will not be private."myCustomAttribute":"myAttributeValue",]}context=EvaluationContext(null,attributes)Learn moreCheck out ourdocumentationfor in-depth instructions on configuring and using LaunchDarkly. You can also head straight to thecomplete reference guide for this SDK.The authoritative description of all properties and methods is in thepython documentation.ContributingWe encourage pull requests and other contributions from the community. Check out ourcontributing guidelinesfor instructions on how to contribute to this SDK.About LaunchDarklyLaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard.  With LaunchDarkly, you can:Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check outour documentationfor a complete list.Explore LaunchDarklylaunchdarkly.comfor more informationdocs.launchdarkly.comfor our documentation and SDK reference guidesapidocs.launchdarkly.comfor our API documentationblog.launchdarkly.comfor the latest product updates