MariLib is a Python library for interacting with the Mari network.
Project description
MariLib 💫 👀 🐍
MariLib is a Python library to interact with a local Mari network. It connects to a Mari gateway via:
- UART, using MarilibEdge
- MQTT, using MarilibCloud
Example with TUI
MariLib provides a stateful class with gateway and node information, network statistics, and a rich real-time TUI:
To run with a gateway connected via UART:
# for example, using the Inria Argus MQTT broker
(.venv) $ python examples/mari_edge.py -m mqtts://argus.paris.inria.fr:8883
You can see how it works using examples/mari_edge.py --help.
To run with a gateway connected via MQTT:
# for example, using the Inria Argus MQTT broker
(.venv) $ python examples/mari_cloud.py -n 0x0100 -m mqtts://argus.paris.inria.fr:8883
Setup and dependencies
To setup the environment, do:
$ python -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install -e .
Minimal example
Here is a minimal example showcasing how to use MariLib:
import time
from marilib.marilib import MarilibEdge
from marilib.serial_uart import get_default_port
def main():
mari = MarilibEdge(lambda event, data: print(event.name, data), get_default_port())
while True:
for node in mari.gateway.nodes:
mari.send_frame(dst=node.address, payload=b"A" * 3)
statistics = [(f"{node.address:016X}", node.stats.received_rssi_dbm()) for node in mari.gateway.nodes]
print(f"Network statistics: {statistics}")
time.sleep(0.25)
if __name__ == "__main__":
main()
See it in action in examples/minimal.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marilib_pkg-0.8.0.tar.gz.
File metadata
- Download URL: marilib_pkg-0.8.0.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
787a3e90107b4219fb44f8212afc1103e90e6b017f3a32a2f6422c7fcb2c31a2
|
|
| MD5 |
8f67a1179a15803797d9c56c507fcf4a
|
|
| BLAKE2b-256 |
4f0b205c11bbe7bca88d9983bcb113aa3286073247e95ce934c06027a7a8ea41
|
File details
Details for the file marilib_pkg-0.8.0-py3-none-any.whl.
File metadata
- Download URL: marilib_pkg-0.8.0-py3-none-any.whl
- Upload date:
- Size: 44.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9e041aedb71a62fc6e28be065e96a58d5df4c3aac5a5b874e77ad8d3ea4b12f
|
|
| MD5 |
63c35ffd71a8fad66990483b35e3efd1
|
|
| BLAKE2b-256 |
ad261824a0edc4b9edabd1612358465e4d6344c5a950f20ed343b4bba6e44c4d
|