Openfeature provider for Flagsmith
Project description
flagsmith-openfeature-provider-python
The Flagsmith provider allows you to connect to your Flagsmith instance through the OpenFeature SDK
Python SDK usage
Install dependencies
First, you'll need to install the OpenFeature SDK and the Flagsmith Provider.
pip install openfeature-sdk openfeature-provider-flagsmith
Using the Flagsmith Provider with the OpenFeature SDK
To create a Flagsmith provider you will need to provide a number of arguments. These are shown and described below. See the Flagsmith docs for further information on the configuration options available for the Flagsmith python client.
from flagsmith import Flagsmith
from openfeature_flagsmith.provider import FlagsmithProvider
provider = FlagsmithProvider(
# Provide an instance of the Flagsmith python client.
# Required: True
client=Flagsmith(...),
# By enabling the use_flagsmith_defaults setting, you can instruct the OpenFeature SDK to use
# the default logic included in the Flagsmith client as per the docs here:
# https://docs.flagsmith.com/clients/server-side#managing-default-flags. This will override the
# default provided at evaluation time in the OpenFeature SDK in most cases (excluding those where
# an unexpected exception happens in the Flagsmith client itself).
# Required: False
# Default: False
use_flagsmith_defaults=False,
# By default, when evaluating the boolean value of a feature in the OpenFeature SDK, the Flagsmith
# OpenFeature Provider will use the 'Enabled' state of the feature as defined in Flagsmith. This
# behaviour can be changed to use the 'value' field defined in the Flagsmith feature instead by
# enabling the use_boolean_config_value setting.
# Note: this relies on the value being defined as a Boolean in Flagsmith. If the value is not a
# Boolean, an error will occur and the default value provided as part of the evaluation will be
# returned instead.
# Required: False
# Default: False
use_boolean_config_value=False,
# By default, the Flagsmith OpenFeature Provider will raise an exception (triggering the
# OpenFeature SDK to return the provided default value) if the flag is disabled. This behaviour
# can be configured by enabling this flag so that the Flagsmith OpenFeature provider ignores
# the enabled state of a flag when returning a value.
# Required: False
# Default: False
return_value_for_disabled_flags=False,
)
The provider can then be used with the OpenFeature client as per the documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file openfeature_provider_flagsmith-0.1.3.tar.gz.
File metadata
- Download URL: openfeature_provider_flagsmith-0.1.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81e229bfae6a1728afe8c531ec7825f3947902570862e91f9114c6f04fab0c6b
|
|
| MD5 |
756d61a306814def965f3872921e95e9
|
|
| BLAKE2b-256 |
130d810cfa2d98457a88614c0716d519e1742df255552f491daafa784e1542d5
|
Provenance
The following attestation bundles were made for openfeature_provider_flagsmith-0.1.3.tar.gz:
Publisher:
publish.yml on Flagsmith/flagsmith-openfeature-provider-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openfeature_provider_flagsmith-0.1.3.tar.gz -
Subject digest:
81e229bfae6a1728afe8c531ec7825f3947902570862e91f9114c6f04fab0c6b - Sigstore transparency entry: 227265190
- Sigstore integration time:
-
Permalink:
Flagsmith/flagsmith-openfeature-provider-python@26930dd5888eb9db3ca5ddb92c53193af3c47c54 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Flagsmith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@26930dd5888eb9db3ca5ddb92c53193af3c47c54 -
Trigger Event:
push
-
Statement type: