Skip to main content
The Confidence Python SDK provides ultra-low latency feature flag evaluation for Python applications using the Confidence Resolver—a Rust-based resolver that runs as WebAssembly.

Features

  • Local evaluation: Flag rules evaluate on your infrastructure in microseconds
  • OpenFeature compatible: Standard feature flag API through OpenFeature provider
  • Background sync: Flag rules and logging sync with Confidence in the background
  • High reliability: No network dependency at evaluation time

Installation

pip install confidence-openfeature-provider
Requirements: Python 3.10+ and OpenFeature SDK 0.8.0+.

Quickstart

from openfeature import api
from openfeature.evaluation_context import EvaluationContext
from confidence import ConfidenceProvider

# Initialize the Confidence provider
provider = ConfidenceProvider(client_secret="your-client-secret")

# Register with OpenFeature
api.set_provider(provider)
client = api.get_client()

# Evaluate a flag with context
context = EvaluationContext(
    targeting_key="user-123",
    attributes={
        "country": "US",
        "plan": "premium",
    }
)

enabled = client.get_boolean_value("my-feature-flag.enabled", default_value=False, evaluation_context=context)
print(f"Flag value: {enabled}")

# Shutdown the provider when your application exits
api.shutdown()

Resources