Skip to main content

Eppo SDK for Python

Project description

Eppo SDK for Python

Getting Started

Install and initialize the SDK client

Install the package:

python3 -m pip install --upgrade eppo-server-sdk

Initialize the SDK with your Eppo API key:

import eppo_client
from eppo_client import Config

eppo_client.init(Config(api_key="<YOUR-API-KEY>"))

The init method should be called once on applications startup. The initialization method kicks off a polling process to retrieve experiment configurations from Eppo at regular intervals.

Use the client to assign variations

Prerequisite: you must have configured an experiment in Eppo. To assign variations, your experiment should have a RUNNING status and a non-zero traffic allocation.

Use the assignment API in any part of your code that needs to assign subjects to experiment variations:

import eppo_client

client = eppo_client.get_instance()
assigned_variation = client.assign("<subject>", "<experimentKey>")

The subject argument can be any entity identifier (e.g. a user ID). The experimentKey argument is the identifier of your Eppo experiment.

The assign function will return null if the experiment is not running or if the subject is not part of the experiment traffic allocation.

The eppo_client.get_instance() method returns a singleton client instance that is intended to be reused for the lifetime of your application.

Supported Python Versions

This version of the SDK is compatible with Python 3.6 and above.

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

eppo-server-sdk-0.0.3.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

eppo_server_sdk-0.0.3-py3-none-any.whl (10.4 kB view hashes)

Uploaded Python 3

Supported by

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