Metadata-Version: 2.4
Name: lange-python
Version: 0.7.1
Summary: A bundeld set of tools, clients for the lange-suite of tools and more.
Author: contact@robertlange.me
Requires-Python: >=3.11
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Provides-Extra: ai-cuda
Provides-Extra: ai-mlx
Provides-Extra: dev
Requires-Dist: certifi (>=2026.0.0)
Requires-Dist: click (>=8.0.0,<9.0.0)
Requires-Dist: httpx (>=0.28.1,<0.29.0)
Requires-Dist: idna (>=3.15)
Requires-Dist: llama-cpp-python[server] (==0.3.32) ; extra == "ai-cuda"
Requires-Dist: mlx-lm ; extra == "ai-mlx"
Requires-Dist: mlx_vlm ; extra == "ai-mlx"
Requires-Dist: openai (>=2.40.0) ; extra == "dev"
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
Requires-Dist: python-dotenv (>=1.2.2)
Requires-Dist: ruff (>=0.15.20)
Requires-Dist: uvicorn (>=0.47.0) ; extra == "ai-cuda"
Requires-Dist: uvicorn (>=0.47.0) ; extra == "ai-mlx"
Requires-Dist: websockets (>=12.0,<20.0)
Description-Content-Type: text/markdown

# lange-python

Python helpers for Lange services.

## Mesh Relay Worker

`MeshWorker` connects a local HTTP service to the Lange mesh relay and forwards
public relay requests to your local target.

```bash
pip install lange-python
```

```python
import asyncio
import time

from lange.mesh.worker import MeshWorker

relay = MeshWorker(
    name="default",
    relay_target="http://localhost:3000",
)

relay.start()

try:
    while relay.remote_relay_address is None and relay.is_alive():
        time.sleep(0.25)
    print(relay.remote_relay_address)
finally:
    asyncio.run(relay.stop())
```

The worker connects to `wss://mesh.lange-labs.com` by default and receives a
public relay address such as `https://default.mesh.lange-labs.com/`.

If a mesh deployment requires bearer authentication, pass the token as
`api_key`. Keep API keys in the environment or a local secret store instead of
hardcoding them in application code.

```python
import os

from lange.mesh.worker import MeshWorker

relay = MeshWorker(
    name="default",
    relay_target="http://localhost:3000",
    api_key=os.environ["LANGE_LABS_API_KEY"],
)
```

The relay exposes lifecycle state for integrations:

- `remote_relay_address`: public REST relay address returned by the mesh service

Stop the worker from an async context:

```python
await relay.stop()
```

