Skip to content

configcat/openfeature-python

Repository files navigation

ConfigCat OpenFeature Provider for Python

CI PyPI PyPI

This repository contains an OpenFeature provider that allows ConfigCat to be used with the OpenFeature Python SDK.

Installation

pip install configcat-openfeature-provider

Usage

The ConfigCatProvider constructor takes the SDK key and an optional ConfigCatOptions argument containing the additional configuration options for the ConfigCat Python SDK:

from configcatclient import ConfigCatOptions, PollingMode
from openfeature import api
from configcat_openfeature_provider import ConfigCatProvider

# Configure the OpenFeature API with the ConfigCat provider.
api.set_provider(
    ConfigCatProvider(
        "<YOUR-CONFIGCAT-SDK-KEY>",
        # Configure the ConfigCat SDK.
        ConfigCatOptions(
            polling_mode=PollingMode.auto_poll(60),
        ),
    )
)

# Create a client.
client = api.get_client()

# Evaluate a feature flag.
is_awesome_feature_enabled = client.get_boolean_value("isAwesomeFeatureEnabled", False)

For more information about all the configuration options, see the Python SDK documentation.

Need help?

https://configcat.com/support

Contributing

Contributions are welcome. For more info please read the Contribution Guideline.

About ConfigCat

ConfigCat is a feature flag and configuration management service that lets you separate releases from deployments. You can turn your features ON/OFF using ConfigCat Dashboard even after they are deployed. ConfigCat lets you target specific groups of users based on region, email or any other custom user attribute.

ConfigCat is a hosted feature flag service. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.