Skip to main content


PyPI version

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 💯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.

Metadata

Release files for amplitude-experiment 1.13.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amplitude-experiment 1.13.2
File Size Uploaded Provenance Actions
amplitude_experiment-1.13.2.tar.gz 91.1 kB With provenance Details for amplitude_experiment-1.13.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for amplitude-experiment 1.13.2
File Interpreter ABI Platform Actions
amplitude_experiment-1.13.2-py3-none-any.whl Python 3 none any Details for amplitude_experiment-1.13.2-py3-none-any.whl

Total release size: 221.1 kB

Release files / amplitude_experiment-1.13.2.tar.gz

Download URL amplitude_experiment-1.13.2.tar.gz
Size 91.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d26527c5bfa58eab8d39579e06b4ff2da251d4b1803dbf394c1c8f01b7f9600f
BLAKE2b-256 checksum
How to use checksums
083390c3e535beaeee4eba5c006c6b93ad8006335c49b9213ab0611536491864
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 Nov 10, 2026.

Transparency log

Release files / amplitude_experiment-1.13.2-py3-none-any.whl

Download URL amplitude_experiment-1.13.2-py3-none-any.whl
Size 129.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
734970224ab5e8485fa7d318d9946ac89b2c3dabbd60e8809dd7af6a2ecdd2bb
BLAKE2b-256 checksum
How to use checksums
e36bc0b87bee8b602c25ff2ef66323aa82818982ca4b7d8a38c6b5ed78619280
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 Nov 10, 2026.

Transparency log

Security for amplitude-experiment 1.13.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for amplitude_experiment-1.13.2.tar.gz

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 Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.13.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page