Skip to main content

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:

mari-edge-2.webm

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marilib_pkg-0.7.0rc1.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marilib_pkg-0.7.0rc1-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file marilib_pkg-0.7.0rc1.tar.gz.

File metadata

  • Download URL: marilib_pkg-0.7.0rc1.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for marilib_pkg-0.7.0rc1.tar.gz
Algorithm Hash digest
SHA256 b11b9a57c375972b4724f82c267b5a81887cdddf64eba30a291dbbfd75c9585d
MD5 5f39566488727fcc3775fab658f2000e
BLAKE2b-256 b0b62f0c9d7f460f2af3078da367525ae98b3bc6d74e7992674a71023582107f

See more details on using hashes here.

File details

Details for the file marilib_pkg-0.7.0rc1-py3-none-any.whl.

File metadata

  • Download URL: marilib_pkg-0.7.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 43.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for marilib_pkg-0.7.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 795866dd9c74773cab9c70acf57409605bfbe4287fd8ed8ce834b229be84e290
MD5 1658eb8f7a9b9ab796a65d046b319934
BLAKE2b-256 555cdf8849518459b8709b658606cd8833648f75f9de749b6ccc3e0c7747eb97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page