Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit 7947d6b

Browse files
authored
Update README.md (#4)
1 parent 3da7f0b commit 7947d6b

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,38 @@
11
# Eppo SDK for Python
22

3+
## Getting Started
4+
5+
### Install and initialize the SDK client
6+
Install the package:
7+
```
8+
python3 -m pip install --upgrade eppo-server-sdk
9+
```
10+
11+
Initialize the SDK with your Eppo API key:
12+
```
13+
import eppo_client
14+
from eppo_client import Config
15+
16+
eppo_client.init(Config(api_key="<YOUR-API-KEY>"))
17+
```
18+
**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.
19+
20+
### Use the client to assign variations
21+
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.
22+
23+
Use the assignment API in any part of your code that needs to assign subjects to experiment variations:
24+
```
25+
import eppo_client
26+
27+
client = eppo_client.get_instance()
28+
assigned_variation = client.assign("<subject>", "<experimentKey>")
29+
```
30+
31+
The `subject` argument can be any entity identifier (e.g. a user ID). The experimentKey argument is the identifier of your Eppo experiment.
32+
33+
The `assign` function will return null if the experiment is not running or if the subject is not part of the experiment traffic allocation.
34+
35+
The `eppo_client.get_instance()` method returns a singleton client instance that is intended to be reused for the lifetime of your application.
36+
337
## Supported Python Versions
4-
This version of the SDK is compatible with Python 3.6 and above.
38+
This version of the SDK is compatible with Python 3.6 and above.

0 commit comments

Comments
 (0)