> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Python

> Confidence Python SDK for server-side feature flag evaluation.

The Confidence Python SDK provides ultra-low latency feature flag evaluation for Python applications using the [Confidence Resolver](https://github.com/spotify/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

```bash theme={null}
pip install confidence-openfeature-provider
```

**Requirements**: Python 3.10+ and OpenFeature SDK 0.8.0+.

## Quickstart

```python theme={null}
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_and_wait(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

<CardGroup cols={2}>
  <Card title="GitHub repository" icon="github" href="https://github.com/spotify/confidence-resolver/tree/main/openfeature-provider/python">
    Source code and examples
  </Card>

  <Card title="OpenFeature Python SDK" icon="flag" href="https://openfeature.dev/docs/reference/technologies/server/python">
    OpenFeature documentation
  </Card>

  <Card title="Context" icon="sliders" href="/docs/sdks/context">
    Configure evaluation context
  </Card>

  <Card title="Apply events" icon="chart-line" href="/docs/sdks/apply-event">
    Understand flag assignment tracking
  </Card>
</CardGroup>
