Experiment Python SDK
Amplitude Python Server SDK for Experiment.
Installation
pip install amplitude-experiment
Remote Evaluation Quick Start
from amplitude_experiment import Experiment, RemoteEvaluationConfig, RemoteEvaluationClient, User
# (1) Get your deployment's API key
apiKey = 'YOUR-API-KEY'
# (2) Initialize the experiment remote evaluation
experiment = Experiment.initialize_remote(api_key)
# (3) Fetch variants for a user
user = User(
device_id="abcdefg",
user_id="user@company.com",
user_properties={
'premium': True
}
)
# (4) Lookup a flag's variant
#
# To fetch synchronous
variants = experiment.fetch(user)
variant = variants['YOUR-FLAG-KEY']
if variant:
if variant.value == 'on':
# Flag is on
else:
# Flag is off
# To fetch asynchronous
experiment.fetch_async(user, fetch_callback)
def fetch_callback(user, variants):
variant = variants['YOUR-FLAG-KEY']
if variant:
if variant.value == 'on':
# Flag is on
else:
# Flag is off
Local Evaluation Quick Start
# (1) Initialize the local evaluation client with a server deployment key.
experiment = Experiment.initialize_local(api_key)
# (2) Start the local evaluation client.
experiment.start()
# (3) Evaluate a user.
user = User(
device_id="abcdefg",
user_id="user@company.com",
user_properties={
'premium': True
}
)
variants = experiment.evaluate(user)
Running Unit Tests Suite
To setup for running test on local, create a .env file with following
contents, and replace {API_KEY} and {SECRET_KEY} (or {EU_API_KEY} and {EU_SECRET_KEY} for EU data center) for the project in test:
API_KEY={API_KEY}
SECRET_KEY={SECRET_KEY}
More Information
Please visit our :100:Developer Center for more instructions on using our the SDK.
See our Experiment Python SDK Docs for a list and description of all available SDK methods.
Need Help?
If you have any problems or issues over our SDK, feel free to create a github issue or submit a request on Amplitude Help.
Release files for amplitude-experiment 1.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| amplitude_experiment-1.13.0.tar.gz | 91.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| amplitude_experiment-1.13.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 220.9 kB
Release files / amplitude_experiment-1.13.0.tar.gz
| Download URL | amplitude_experiment-1.13.0.tar.gz |
|---|---|
| Size | 91.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3758c1d92396c6677c734449fd856d76964d7eeb89bcbca4474154f53036e0d0
|
|
BLAKE2b-256 checksum How to use checksums |
441bbf8e9082d83ab6d4f91d38f9840d4dfdf8cbd98722e8711ad322d2955912
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / amplitude_experiment-1.13.0-py3-none-any.whl
| Download URL | amplitude_experiment-1.13.0-py3-none-any.whl |
|---|---|
| Size | 129.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af12600fa4df2d0aace03d3ab43d2e2bb1daa4f1fc0882c2c13d6620e5223b1b
|
|
BLAKE2b-256 checksum How to use checksums |
1ab462182669a4eeede651219b92205554d1eda1a91a519fbf05265dc0ba4fc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency log