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

# Molecule Python SDK: Installation and Configuration

> Install the Molecule Python SDK via pip or directly from GitHub. Requires Python 3.10 or later. Dependencies: httpx, pynacl, websockets.

The Molecule Python SDK gives you a typed, authenticated client for placing orders, streaming real-time data, and managing portfolio state across prediction market venues. It handles Ed25519 request signing, WebSocket connections, and error mapping so you can focus on your trading logic.

## Requirements

The SDK requires **Python 3.10 or later**. The following dependencies are installed automatically — you do not need to install them separately.

| Dependency | Version | Purpose |
| - | - | - |
| `httpx` | `>=0.27` | HTTP client for all REST requests |
| `pynacl` | `>=1.5` | Ed25519 request signing |
| `websockets` | `>=12` | WebSocket client for streaming feeds |

## Install from PyPI

Install the latest stable release using pip:

```bash theme={"dark"}
pip install molecule
```

## Install from GitHub (Pre-release)

To install the latest unreleased version directly from the `main` branch:

```bash theme={"dark"}
pip install "molecule @ git+https://github.com/Molecule-Trading/molecule-python-sdk.git"
```

## Verify Installation

Confirm the package is installed and check the version:

```python theme={"dark"}
import molecule

print(molecule.__version__)  # 0.1.0
```

## Environment Variables

The SDK reads configuration from environment variables when values are not passed explicitly to the constructor. Use these to keep credentials out of source code.

| Variable | Description |
| - | - |
| `MOLECULE_BASE_URL` | API base URL. Required if `base_url` is not passed to the constructor. |
| `MOLECULE_KEY_ID` | Trading key ID. Can be passed explicitly to the constructor instead. |
| `MOLECULE_PRIVATE_KEY` | Base64-encoded 32-byte Ed25519 seed. Can be passed explicitly. |

Store your credentials in a `.env` file at the root of your project:

```bash theme={"dark"}
MOLECULE_BASE_URL=https://api.molecule.example
MOLECULE_KEY_ID=your-key-id
MOLECULE_PRIVATE_KEY=your-base64-encoded-seed
```

Load the file before constructing the client using `python-dotenv`:

```python theme={"dark"}
from dotenv import load_dotenv
from molecule import Molecule

load_dotenv()

# base_url, key_id, and private_key are read from the environment
client = Molecule()
```

<Note>
  `base_url` is always required. Set it via the `MOLECULE_BASE_URL` environment variable or pass it directly as the `base_url` argument to the constructor. The SDK raises a `ValueError` at construction time if neither is provided.
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.