Install & Compatibility
Where this runs
tested against v0.22.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 29.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.7s · import 0.000s · 30MB
28MB installed
● package 28MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
StatsigServer
✓ from statsig_python_core import StatsigServer
✗ from statsig_python_core import StatsigServer
This quickstart demonstrates how to initialize the Statsig server SDK, define a user, check a feature gate, retrieve dynamic configs and experiments, and properly shut down the SDK. Ensure you replace `YOUR_SERVER_SECRET_KEY_HERE` with your actual Statsig server secret key and adjust gate/config/experiment names.
import asyncio
import os
from statsig import StatsigServer
async def main():
# Replace with your actual Server Secret Key, or set as STATSIG_SERVER_SECRET_KEY env var
sdk_key = os.environ.get("STATSIG_SERVER_SECRET_KEY", "YOUR_SERVER_SECRET_KEY_HERE")
if sdk_key == "YOUR_SERVER_SECRET_KEY_HERE":
print("Please set your STATSIG_SERVER_SECRET_KEY environment variable or replace the placeholder.")
return
await StatsigServer.initialize(sdk_key)
# Define a user object using a dictionary (StatsigUser class is deprecated)
user = {
"userID": "test-user-123",
"email": "test@example.com",
"custom": {"plan": "enterprise"}
}
# Check a feature gate
if await StatsigServer.check_gate(user, "my_feature_gate"): # Replace with your gate name
print("my_feature_gate is ON for this user!")
else:
print("my_feature_gate is OFF for this user.")
# Get a dynamic config
config = await StatsigServer.get_config(user, "my_dynamic_config") # Replace with your config name
string_value = config.get("string_param", "default_string")
int_value = config.get("int_param", 0)
print(f"Config values: string_param={string_value}, int_param={int_value}")
# Get an experiment
experiment = await StatsigServer.get_experiment(user, "my_experiment") # Replace with your experiment name
variant_value = experiment.get("variant_param", "control")
print(f"Experiment variant: {variant_value}")
# IMPORTANT: Call shutdown when your application exits to ensure metrics are flushed
await StatsigServer.shutdown()
if __name__ == "__main__":
asyncio.run(main())
Upgrade
Version history
0.22.0latest on PyPI · released Aug 14, 2026
Audit
Dependencies
httpxrequiredHTTP client for API communication
pydanticrequiredData validation and settings management
pycryptodomexrequiredCryptographic operations for payload decryption