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

# Python SDK - Installation

> Register the GitLab PyPI registry and install the Python SDK.

The `westyx-nexus-sdk` package is hosted on the [GitLab PyPI Package Registry](https://gitlab.com/westyx/nexus/sdk/python/-/packages). It is **public** - no token is required to install.

## 1. Configure pip to look at the registry

The simplest option is to set an extra index URL globally for your user account:

```sh theme={null}
pip config set --user global.extra-index-url \
  "https://gitlab.com/api/v4/projects/81978638/packages/pypi/simple"
```

Or pin per-project in `requirements.txt`:

```text theme={null}
--extra-index-url https://gitlab.com/api/v4/projects/81978638/packages/pypi/simple
westyx-nexus-sdk==0.10.0
```

<Info>
  No token is required - the registry is public.
</Info>

## 2. Install

```sh theme={null}
# Base package - the core sync + async client
pip install westyx-nexus-sdk

# With a framework adapter
pip install "westyx-nexus-sdk[django]"
pip install "westyx-nexus-sdk[fastapi]"
pip install "westyx-nexus-sdk[flask]"
```

## Requirements

* **Python 3.11** or newer
* **httpx >= 0.25** (pulled in automatically; the only runtime dependency)
* (optional) **Django 4.2+**, **FastAPI 0.100+**, **Flask 2.3+** - only required if you use the matching framework adapter

## Importing

```python theme={null}
from westyx_nexus import NexusClient, NexusConfig
# or for asyncio code:
from westyx_nexus import AsyncNexusClient, NexusConfig
```

The framework adapters live in submodules:

```python theme={null}
from westyx_nexus.django import get_client
from westyx_nexus.fastapi import attach_nexus, get_nexus
from westyx_nexus.flask import NexusExtension, get_nexus
```

## Verifying connectivity

Before writing any code, confirm your endpoint and API key work with a plain `curl`:

```sh theme={null}
curl -s \
  -H "X-Nexus-API-Key: wxs_..." \
  https://your-service.westyx.dev/v1/sync
```

A valid response returns a JSON snapshot with your `configs`, `secrets`, and `flags`. An `HTTP 401` means the key is wrong; `HTTP 404` means the slug is wrong.

To watch the live SSE stream:

```sh theme={null}
curl -N \
  -H "X-Nexus-API-Key: wxs_..." \
  -H "Accept: text/event-stream" \
  https://your-service.westyx.dev/v1/stream
```

You should see `event:resync` arrive within a second. Press `Ctrl+C` to stop.

## Troubleshooting

* **`Could not find a version that satisfies the requirement westyx-nexus-sdk`** - pip didn't see the GitLab index. Confirm `pip config get global.extra-index-url` returns your registry URL.
* **`ModuleNotFoundError: No module named 'westyx_nexus.django'`** - you didn't install the `django` extra. Run `pip install "westyx-nexus-sdk[django]"`.
* **SSL / proxy errors** - typical behind a corporate firewall. Ensure your build agents can reach `gitlab.com` directly, or set `HTTPS_PROXY` appropriately.
