Python Client - Getting Started
The EFF Python client is a tool designed to manage feature flags in your python applications. It provides an interface to check if a feature flag is enabled for a given discriminator. The client is designed to be instantiated once and reused throughout the application.
Table of Contents
Installation
Install the latest version of the EFF Python client in your projects chosen dependency management tool. The full list of available versions can be found in Artifactory. If you’re using uv, see the https://asudev.jira.com/wiki/spaces/ARTF/pages/4130996331guide. You can use any tool (pip, poetry, etc.) but the Artifactory configuration will differ slightly.
Assuming you use uv, install with
uv add asu-eff-client
Configuration
The client is configured with sensible defaults. Most people won't need to change them, but you can override them with environment variables.
Environment Variable | Description | Default |
---|---|---|
| Environment to evaluate feature flags against |
|
| URL to fetch feature flag state from |
|
| Duration (in seconds) after which cache is considered stale |
|
| Timeout (in seconds) for fetching feature flag state |
|
| Raise error if first fetch fails and cache is empty |
|
| Raise error if cache is stale |
|
Example: Checking Feature Flags
To check if a feature flag, call the .is_enabled(…)
method on the feature flags client. This method returns a boolean and takes 2 parameters:
Feature Flag ID - the ID of the feature flag, which can be copied from the EFF UI (ie.
SOME_GREAT_FEATURE_123456
).Discriminator - some kind of value used to differentiate users and bucket requests into different allocations, most commonly a user ID of some kind. See Feature Flags Primer | Discriminator for more details. This value must be a non-empty string.
from asu_eff_client import EffClient
eff_client = EffClient()
if eff_client.is_enabled("SOME_GREAT_FEATURE_123456", "user_123"):
print("Feature flag is enabled!")
else:
print("Feature flag is disabled.")