Skip to main content

GO Feature Flag provider for OpenFeature

Project description

GO Feature Flag Python Provider

GO Feature Flag provider allows you to connect to your GO Feature Flag instance.

GO Feature Flag believes in simplicity and offers a simple and lightweight solution to use feature flags.
Our focus is to avoid any complex infrastructure work to use GO Feature Flag.

This is a complete feature flagging solution with the possibility to target only a group of users, use any types of flags, store your configuration in various location and advanced rollout functionality. You can also collect usage data of your flags and be notified of configuration changes.

Python SDK usage

Install dependencies

The first things we will do is install the Open Feature SDK and the GO Feature Flag provider.

pip install gofeatureflag-python-provider

Initialize your Open Feature client

To evaluate the flags you need to have an Open Feature configured in you app. This code block shows you how you can create a client that you can use in your application.

from gofeatureflag_python_provider.provider import GoFeatureFlagProvider
from gofeatureflag_python_provider.options import GoFeatureFlagOptions
from openfeature import api
from openfeature.evaluation_context import EvaluationContext

# ...

goff_provider = GoFeatureFlagProvider(
    options=GoFeatureFlagOptions(endpoint="https://gofeatureflag.org/")
)
api.set_provider(goff_provider)
client = api.get_client(domain="test-client")

Evaluate your flag

This code block explains how you can create an EvaluationContext and use it to evaluate your flag.

In this example we are evaluating a boolean flag, but other types are available.

Refer to the Open Feature documentation to know more about it.

# Context of your flag evaluation.
# With GO Feature Flag you MUST have a targetingKey that is a unique identifier of the user.
evaluation_ctx = EvaluationContext(
    targeting_key="d45e303a-38c2-11ed-a261-0242ac120002",
    attributes={
        "email": "john.doe@gofeatureflag.org",
        "firstname": "john",
        "lastname": "doe",
        "anonymous": False,
        "professional": True,
        "rate": 3.14,
        "age": 30,
        "company_info": {"name": "my_company", "size": 120},
        "labels": ["pro", "beta"],
    },
)

admin_flag = client.get_boolean_value(
          flag_key=flag_key,
          default_value=default_value,
          evaluation_context=ctx,
      )

if admin_flag:
  # flag "flag-only-for-admin" is true for the user
else:
  # flag "flag-only-for-admin" is false for the user

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gofeatureflag_python_provider-1.0.0.tar.gz (377.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gofeatureflag_python_provider-1.0.0-py3-none-any.whl (310.2 kB view details)

Uploaded Python 3

File details

Details for the file gofeatureflag_python_provider-1.0.0.tar.gz.

File metadata

  • Download URL: gofeatureflag_python_provider-1.0.0.tar.gz
  • Upload date:
  • Size: 377.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gofeatureflag_python_provider-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7f3f328fc217431ac2dc69844fad39e7d91ce83f204b8d126a8e10bf244880e8
MD5 0fdb1ceb72397e7ec2e71554239aafad
BLAKE2b-256 39c1d52dc1875367efbb8005a2baae3e9dbd0f359a483464487457e3d14c6e5c

See more details on using hashes here.

File details

Details for the file gofeatureflag_python_provider-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gofeatureflag_python_provider-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 310.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gofeatureflag_python_provider-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12c85382d8aafcf20a50fcee57476263d54369e234586d81e0463de4a5a5ed1a
MD5 9bd53e3a92f245f3f14ae95d1d401971
BLAKE2b-256 54db9dbd581511e95fdbd0ead7c9c1227c16ab91d8e6a69230f2e884cbbc498c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page