pamoja-core 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pamoja_core-0.1.3/Cargo.toml +35 -0
- pamoja_core-0.1.3/PKG-INFO +67 -0
- pamoja_core-0.1.3/README.md +49 -0
- pamoja_core-0.1.3/bindings/python/.gitignore +13 -0
- pamoja_core-0.1.3/bindings/python/Cargo.lock +1486 -0
- pamoja_core-0.1.3/bindings/python/Cargo.toml +40 -0
- pamoja_core-0.1.3/bindings/python/README.md +49 -0
- pamoja_core-0.1.3/bindings/python/src/lib.rs +43 -0
- pamoja_core-0.1.3/bindings/python/src/mqtt.rs +164 -0
- pamoja_core-0.1.3/bindings/python/src/stub_gen.rs +13 -0
- pamoja_core-0.1.3/bindings/python/tests/test_smoke.py +48 -0
- pamoja_core-0.1.3/crates/pamoja-core/Cargo.toml +12 -0
- pamoja_core-0.1.3/crates/pamoja-core/src/bus.rs +40 -0
- pamoja_core-0.1.3/crates/pamoja-core/src/device.rs +110 -0
- pamoja_core-0.1.3/crates/pamoja-core/src/error.rs +58 -0
- pamoja_core-0.1.3/crates/pamoja-core/src/lib.rs +56 -0
- pamoja_core-0.1.3/crates/pamoja-core/src/store.rs +66 -0
- pamoja_core-0.1.3/crates/pamoja-core/src/transport.rs +57 -0
- pamoja_core-0.1.3/crates/pamoja-mqtt/Cargo.toml +21 -0
- pamoja_core-0.1.3/crates/pamoja-mqtt/src/lib.rs +383 -0
- pamoja_core-0.1.3/crates/pamoja-mqtt/tests/roundtrip.rs +112 -0
- pamoja_core-0.1.3/pyproject.toml +30 -0
- pamoja_core-0.1.3/python/pamoja/__init__.py +14 -0
- pamoja_core-0.1.3/python/pamoja/_core/__init__.pyi +68 -0
- pamoja_core-0.1.3/python/pamoja/mqtt.py +138 -0
- pamoja_core-0.1.3/python/pamoja/py.typed +0 -0
- pamoja_core-0.1.3/python/pamoja/raw.py +11 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
resolver = "2"
|
|
3
|
+
members = [
|
|
4
|
+
"crates/pamoja-core",
|
|
5
|
+
"crates/pamoja-codec",
|
|
6
|
+
"crates/pamoja-mqtt",
|
|
7
|
+
"crates/xtask",
|
|
8
|
+
]
|
|
9
|
+
# Language bindings are standalone crates with their own toolchains and lint
|
|
10
|
+
# policy; they are built by their own pipelines, not the core workspace.
|
|
11
|
+
exclude = ["bindings/node", "bindings/python"]
|
|
12
|
+
|
|
13
|
+
[workspace.package]
|
|
14
|
+
version = "0.1.3"
|
|
15
|
+
edition = "2021"
|
|
16
|
+
rust-version = "1.75"
|
|
17
|
+
license = "MIT"
|
|
18
|
+
repository = "https://github.com/tonywied17/pamoja"
|
|
19
|
+
authors = ["tonywied17"]
|
|
20
|
+
|
|
21
|
+
# Internal crate dependencies. The version is required so each crate can be
|
|
22
|
+
# published to crates.io, and is kept in lockstep with workspace.package.version.
|
|
23
|
+
[workspace.dependencies]
|
|
24
|
+
pamoja-core = { path = "crates/pamoja-core", version = "0.1.3" }
|
|
25
|
+
|
|
26
|
+
[workspace.lints.rust]
|
|
27
|
+
missing_docs = "deny"
|
|
28
|
+
unsafe_code = "warn"
|
|
29
|
+
|
|
30
|
+
[workspace.lints.clippy]
|
|
31
|
+
all = "warn"
|
|
32
|
+
|
|
33
|
+
[profile.release]
|
|
34
|
+
lto = "thin"
|
|
35
|
+
codegen-units = 1
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pamoja-core
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Topic :: Communications
|
|
9
|
+
Classifier: Topic :: System :: Hardware
|
|
10
|
+
Summary: Python bindings for the pamoja device SDK core.
|
|
11
|
+
Keywords: iot,robotics,drones,mqtt,embedded
|
|
12
|
+
Author: tonywied17
|
|
13
|
+
License: MIT
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
16
|
+
Project-URL: Repository, https://github.com/tonywied17/pamoja
|
|
17
|
+
|
|
18
|
+
# pamoja-core (Python)
|
|
19
|
+
|
|
20
|
+
Python bindings for the [pamoja](https://github.com/tonywied17/pamoja) device
|
|
21
|
+
SDK core, built with [PyO3](https://pyo3.rs) and [maturin](https://www.maturin.rs).
|
|
22
|
+
|
|
23
|
+
The generated surface is intentionally thin. A hand-written, idiomatic layer is
|
|
24
|
+
added on top of it so Python callers get a native-feeling async API - awaitable
|
|
25
|
+
methods, `async for` over incoming messages, `async with` lifecycle, and
|
|
26
|
+
exceptions for errors - while all behavior stays in the Rust core.
|
|
27
|
+
|
|
28
|
+
The generated low-level contract remains available at `pamoja.raw`.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
pip install pamoja-core
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Build from source
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
python -m venv .venv
|
|
40
|
+
.venv/bin/pip install maturin pytest
|
|
41
|
+
.venv/bin/maturin develop
|
|
42
|
+
.venv/bin/python -m pytest
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`maturin develop` compiles the Rust core into a native extension (`pamoja._core`)
|
|
46
|
+
and installs the `pamoja` package into the active environment.
|
|
47
|
+
|
|
48
|
+
`cargo run --bin stub_gen` regenerates the committed type stub
|
|
49
|
+
`python/pamoja/_core.pyi`. It is a generated artifact, drift-checked in CI so it
|
|
50
|
+
can never fall behind the Rust source.
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import asyncio
|
|
56
|
+
from pamoja import MqttClient
|
|
57
|
+
|
|
58
|
+
async def main():
|
|
59
|
+
async with MqttClient(client_id="sensor-1", host="localhost", port=1883) as client:
|
|
60
|
+
await client.subscribe("sensors/+/temperature")
|
|
61
|
+
await client.publish("sensors/1/temperature", "21.5")
|
|
62
|
+
async for message in client:
|
|
63
|
+
print(message.topic, message.payload.decode())
|
|
64
|
+
|
|
65
|
+
asyncio.run(main())
|
|
66
|
+
```
|
|
67
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# pamoja-core (Python)
|
|
2
|
+
|
|
3
|
+
Python bindings for the [pamoja](https://github.com/tonywied17/pamoja) device
|
|
4
|
+
SDK core, built with [PyO3](https://pyo3.rs) and [maturin](https://www.maturin.rs).
|
|
5
|
+
|
|
6
|
+
The generated surface is intentionally thin. A hand-written, idiomatic layer is
|
|
7
|
+
added on top of it so Python callers get a native-feeling async API - awaitable
|
|
8
|
+
methods, `async for` over incoming messages, `async with` lifecycle, and
|
|
9
|
+
exceptions for errors - while all behavior stays in the Rust core.
|
|
10
|
+
|
|
11
|
+
The generated low-level contract remains available at `pamoja.raw`.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
pip install pamoja-core
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Build from source
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
python -m venv .venv
|
|
23
|
+
.venv/bin/pip install maturin pytest
|
|
24
|
+
.venv/bin/maturin develop
|
|
25
|
+
.venv/bin/python -m pytest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`maturin develop` compiles the Rust core into a native extension (`pamoja._core`)
|
|
29
|
+
and installs the `pamoja` package into the active environment.
|
|
30
|
+
|
|
31
|
+
`cargo run --bin stub_gen` regenerates the committed type stub
|
|
32
|
+
`python/pamoja/_core.pyi`. It is a generated artifact, drift-checked in CI so it
|
|
33
|
+
can never fall behind the Rust source.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
import asyncio
|
|
39
|
+
from pamoja import MqttClient
|
|
40
|
+
|
|
41
|
+
async def main():
|
|
42
|
+
async with MqttClient(client_id="sensor-1", host="localhost", port=1883) as client:
|
|
43
|
+
await client.subscribe("sensors/+/temperature")
|
|
44
|
+
await client.publish("sensors/1/temperature", "21.5")
|
|
45
|
+
async for message in client:
|
|
46
|
+
print(message.topic, message.payload.decode())
|
|
47
|
+
|
|
48
|
+
asyncio.run(main())
|
|
49
|
+
```
|