---
title: "Quickstart: Python"
description: "Evaluate a flag in a Python backend with OpenFeature and EZGH's Python provider."
---

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

# Quickstart: Python

## 1. A flag and a server key

```sh
ezgh flags envs create production
ezgh flags create new-checkout --name "New checkout"
ezgh flags toggle new-checkout --env production --on
export EZGH_FLAGS_SDK_KEY=$(ezgh flags keys create --env production --kind server --name quickstart)
```

## 2. Install

The provider isn't on PyPI yet: install it from GitHub by tag. It needs Python 3.12 or later.

```sh
pip install "git+https://github.com/ezgamehost/flags-provider-python@v0.1.0"
```

It imports as `ezgh_flags` and installs the OpenFeature SDK with it.

## 3. Evaluate

```python
import os

from openfeature import api
from openfeature.evaluation_context import EvaluationContext
from ezgh_flags import EzghProvider

api.set_provider(EzghProvider(os.environ["EZGH_FLAGS_SDK_KEY"]))
flags = api.get_client()

details = flags.get_boolean_details(
    "new-checkout", False, EvaluationContext(targeting_key="user-1842", attributes={"plan": "pro"})
)
print(details.value, details.reason)
```

It prints the value, `True`, and the reason, `STATIC`: turned on, a new boolean flag serves `true` to everyone. Change the flag's targeting ([Targeting](/flags/targeting)) and a
running process gets the change within seconds.

The provider downloads the environment's flags and evaluates locally, follows a stream of changes
in a background thread, and keeps evaluating its last flags while disconnected. `endpoint=`
overrides `https://flags.ezghcloud.com`; `bootstrap_path=` starts it from a file written by
`ezgh flags export`, and `offline=True` uses only that file.

Source: https://docs.ezghcloud.com/flags/quickstart-python/index.mdx
