# Python quickstart

> Wire the Python SDK into your app and see your first flag fetch.

Wire the Python SDK into your app in three steps. This assumes you've already
created a flag and copied a `development` SDK key — if not, start with the
[Quickstart](/docs/quickstart).

## 1. Install

```bash
pip install switchbox-flags
```

The package is `switchbox-flags`; you import it as `switchbox`. It has **zero
runtime dependencies** — nothing else is pulled in.

## 2. Create a client

Create one client when your app starts and reuse it. It fetches your config once
on creation, then refreshes it in the background every 10 seconds.

```python
from switchbox import Switchbox

client = Switchbox(sdk_key="your-sdk-key-from-dashboard")
```

## 3. Check a flag

```python
if client.enabled("new_checkout", user={"user_id": "42"}):
    show_new_checkout()
else:
    show_old_checkout()
```

`enabled()` is an in-memory lookup against the cached config — no network call,
sub-millisecond. The `user` dict is optional; pass it when a flag uses targeting
rules or a percentage rollout (the `user_id` drives deterministic bucketing).

On shutdown, stop the background poller:

```python
client.close()
```

Or use the context manager, which closes for you:

```python
with Switchbox(sdk_key="your-sdk-key-from-dashboard") as client:
    if client.enabled("new_checkout", user={"user_id": "42"}):
        show_new_checkout()
```

## See it connect

Run your app. Within a few seconds, the `development` environment in the
dashboard shows a **Connected ✓** badge — that's your client successfully
fetching its config from the edge.

Now flip the flag off in the dashboard and **Save**. Your app picks up the change
on its next poll (within ~10 seconds), with no redeploy.

## Where to next

- [Python SDK reference](/docs/sdk/python) — every method and option.
- [Targeting rules](/docs/concepts/targeting) — turn a flag on for specific users.
- [Percentage rollouts](/docs/concepts/rollouts) — release to a fraction of users.
- [Use with OpenFeature](/docs/sdk/openfeature): already on the vendor-neutral API? Switchbox is one provider line.
