Metadata-Version: 2.4
Name: tiremo-sdk-client
Version: 0.1.0
Summary: Python client for the TIREMO SDK REST and live WebSocket APIs
Project-URL: Homepage, https://docs.tiremo.ai/developer-guide/sdk-live-data
Project-URL: Repository, https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT
Project-URL: Issues, https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT/issues
Author: Empa Electronics
License-Expression: ISC
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: websockets>=12.0
Provides-Extra: dev
Requires-Dist: ruff>=0.8.0; extra == 'dev'
Description-Content-Type: text/markdown

# tiremo-sdk-client

Official **Python** client for the [TIREMO SDK](https://github.com/Empa-Electronics/TIREMO-SDK) — REST bootstrap plus an async WebSocket live channel for telemetry, presence, and alarms.

Requires **Python 3.10+**.

## Documentation

| Topic | Link |
| --- | --- |
| **SDK Live Data** | [docs.tiremo.ai/developer-guide/sdk-live-data](https://docs.tiremo.ai/developer-guide/sdk-live-data) |
| **API Key Security** | [docs.tiremo.ai/developer-guide/sdk-api-key-security](https://docs.tiremo.ai/developer-guide/sdk-api-key-security) |
| **Source & issues** | [TIREMO-SDK-CLIENT](https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT) |

## Install

```bash
pip install tiremo-sdk-client
```

From source (development):

```bash
make venv lint    # creates .venv and installs editable package
# or from repo root: make install-python
```

```bash
pip install .
```

## Usage

```python
import asyncio

from tiremo_sdk import TiremoClient

async def main() -> None:
    client = TiremoClient(
        api_key="your-api-key",
        base_url="https://sdk.tiremo.ai",
    )

    latest = await client.get_telemetry_latest("device-123", keys=["temperature"])
    print(latest)

    token_response = await client.create_live_token()
    live = client.connect_live_with_token(token_response["token"])

    async def on_telemetry(event: dict) -> None:
        print(event["data"])

    live.on("telemetry", on_telemetry)
    await live.connect()
    await live.subscribe_telemetry("temp", "device-123", keys=["temperature"])
    await asyncio.sleep(60)
    await live.disconnect()

asyncio.run(main())
```

## Related packages

| Package | Use case |
| --- | --- |
| [`@empa-electronics/tiremo-sdk-client-js`](https://www.npmjs.com/package/@empa-electronics/tiremo-sdk-client-js) | Browser / bundler |
| [`@empa-electronics/tiremo-sdk-client-node`](https://www.npmjs.com/package/@empa-electronics/tiremo-sdk-client-node) | Node.js 18+ |

## Release

Uses a local **`.venv`** (Python 3.12 by default — avoids Homebrew 3.14 `pyexpat` issues on macOS).

```bash
make venv
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=<pypi-api-token>
make release    # bumps patch in pyproject.toml, builds, uploads
```

To bump version only: `make patch`

**CI:** bump `version` in `pyproject.toml`, commit, push tag `client-python/v<version>` (PyPI Trusted Publishing → workflow `publish-client-python.yml`).

## License

ISC — [Empa Electronics](https://github.com/Empa-Electronics)
