Metadata-Version: 2.4
Name: raise-suite-sdk
Version: 0.1.2
Summary: RAISE Suite SDK for local devices to communicate with the local RAISE Suite Agent
License: EUPL-1.2
License-File: LICENSE
Author: RAISE Suite Developers
Requires-Python: >=3.11,<4.0
Classifier: License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
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
Classifier: Programming Language :: Python :: 3.15
Provides-Extra: xlsx
Requires-Dist: openpyxl (>=3.1,<4.0) ; extra == "xlsx"
Requires-Dist: paho-mqtt (>=2.0.0,<2.3)
Project-URL: Repository, https://github.com/cyclopt-pc/raise-suite-sdk
Description-Content-Type: text/markdown

# RAISE Suite SDK

A Python SDK that enables local devices to communicate with a local RAISE Suite Agent over MQTT. It provides a clean, type-safe wrapper around `paho-mqtt` v2 for connecting, publishing, subscribing, and handling device messages.

## Features
- **Modern Packaging**: Fully managed via Poetry with `pyproject.toml`.
- **Clean Namespace**: Main class exposed via `from raise_suite_sdk import MqttClient`.
- **Robust Logging**: Zero direct terminal spam. All communications use structured standard Python logging under `raise_suite_sdk`.
- **Type Hints**: Full PEP 484 type signatures for enhanced IDE autocomplete.
- **Batch and File Publishing**: Publish a list of payloads, or every line/row of a JSONL, CSV or Excel (XLSX) file, as separate messages.

## Installation

Using Poetry:
```bash
poetry add raise-suite-sdk
```
 
Or pip:
```bash
pip install raise-suite-sdk
```

### Excel (XLSX) support

Publishing Excel files (`publish_xlsx()`) needs the optional `xlsx` extra, which also installs `openpyxl`. If you want XLSX support, install the SDK with:

```bash
pip install "raise-suite-sdk[xlsx]"
```

Or with Poetry:
```bash
poetry add "raise-suite-sdk[xlsx]"
```

All other features, including JSONL and CSV publishing, work with the standard installation.

## Quick Start

```python
import logging
from raise_suite_sdk import MqttClient

# Configure logging in your parent application
logging.basicConfig(level=logging.INFO)

# Define callback
def on_message_received(topic: str, payload: dict, qos: int):
    print(f"Received message from {topic}: {payload}")

# Initialize and start the client
client = MqttClient(
    client_id="my-app-client",
    user="my_username",
    password="my_password",
    broker="localhost",
    port=1883,
    on_message=on_message_received
)

client.start()

# Publish a dictionary payload (automatically serialized to JSON)
client.publish(topic="my/topic", payload={"status": "ok"})  # QoS 2

# Publish several payloads one by one; invalid samples are logged, skipped and returned as None
results = client.publish_batch(topic="my/topic", payloads=[{"seq": 1}, {"seq": 2}])

# Publish each line of a JSONL file (or text=...) as its own message; invalid lines are logged and skipped
results = client.publish_jsonl(topic="my/topic", path="samples.jsonl")

# Publish each CSV row as a typed JSON message; pass the dataset's JSON Schema for exact types
results = client.publish_csv(topic="my/topic", path="samples.csv", schema=schema)

# Publish each worksheet row as a JSON message (needs: pip install "raise-suite-sdk[xlsx]")
results = client.publish_xlsx(topic="my/topic", path="samples.xlsx")

# Stop the client when done
client.stop()
```

## License

Licensed under the European Union Public Licence 1.2 (EUPL-1.2). See [LICENSE](LICENSE) for the full text.

