Metadata-Version: 2.4
Name: pamoja-core
Version: 0.1.3
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Communications
Classifier: Topic :: System :: Hardware
Summary: Python bindings for the pamoja device SDK core.
Keywords: iot,robotics,drones,mqtt,embedded
Author: tonywied17
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/tonywied17/pamoja

# pamoja-core (Python)

Python bindings for the [pamoja](https://github.com/tonywied17/pamoja) device
SDK core, built with [PyO3](https://pyo3.rs) and [maturin](https://www.maturin.rs).

The generated surface is intentionally thin. A hand-written, idiomatic layer is
added on top of it so Python callers get a native-feeling async API - awaitable
methods, `async for` over incoming messages, `async with` lifecycle, and
exceptions for errors - while all behavior stays in the Rust core.

The generated low-level contract remains available at `pamoja.raw`.

## Install

```
pip install pamoja-core
```

## Build from source

```
python -m venv .venv
.venv/bin/pip install maturin pytest
.venv/bin/maturin develop
.venv/bin/python -m pytest
```

`maturin develop` compiles the Rust core into a native extension (`pamoja._core`)
and installs the `pamoja` package into the active environment.

`cargo run --bin stub_gen` regenerates the committed type stub
`python/pamoja/_core.pyi`. It is a generated artifact, drift-checked in CI so it
can never fall behind the Rust source.

## Usage

```python
import asyncio
from pamoja import MqttClient

async def main():
    async with MqttClient(client_id="sensor-1", host="localhost", port=1883) as client:
        await client.subscribe("sensors/+/temperature")
        await client.publish("sensors/1/temperature", "21.5")
        async for message in client:
            print(message.topic, message.payload.decode())

asyncio.run(main())
```

