Skip to main content

Lightweight IoT device management toolkit (MicroPython client + Python server, sync & async)

Project description

rise-l-net

Lightweight IoT device management toolkit. Pair a small MicroPython client with a Python server and you have heartbeats, telemetry, and device lifecycle events on tap. Pure stdlib by default; aiohttp/aiosqlite are opt-in for the async track.

  • Homepage: https://lyuxc.cn/risel

  • Source: https://github.com/LXC-TRU/RISE.L.net

  • Two-way library: ships both a device-side client and a server-side manager.

  • Sync and async: RISELDevice/RISELServer for stdlib, AsyncRISELDevice/AsyncRISELServer for asyncio.

  • MicroPython-friendly: the sync client runs on ESP32-class boards (no extra deps).

  • Pluggable: middleware, plugins, custom routes, swappable storage and transport.

Install

pip install rise-l-net           # client + sync server (stdlib only)
pip install rise-l-net[async]    # adds aiohttp + aiosqlite
pip install rise-l-net[dev]      # for contributors

Python 3.10+ on the server side. The sync client is also designed to import on MicroPython.

Quick start

Server (sync)

from rise_l_net import RISELServer

server = RISELServer(port=8080)
server.on_report(lambda device_id, payload: print(device_id, payload["event_type"]))
server.start()

Server (async)

import asyncio
from rise_l_net import AsyncRISELServer

async def main() -> None:
    async with AsyncRISELServer(port=8080) as server:
        await server.wait_closed()

asyncio.run(main())

Client (sync, runs on MicroPython too)

from rise_l_net import RISELDevice

device = RISELDevice(
    "http://server.local:8080",
    wifi_ssid="MyWiFi",
    wifi_password="secret",
)
device.start()
device.report("temperature", {"value": 23.5})

Client (async)

import asyncio
from rise_l_net import AsyncRISELDevice

async def main() -> None:
    async with AsyncRISELDevice("http://server.local:8080") as device:
        await device.report("ping", {"v": 1})
        await device.wait_closed()

asyncio.run(main())

Extending

Both client and server expose three extension points: middleware, plugins (server only), and a swappable storage/transport layer.

from rise_l_net import RISELServer
from rise_l_net.server import AuthMiddleware, RateLimitMiddleware, AlertPlugin

server = (
    RISELServer(port=8080)
    .use(AuthMiddleware(api_key="secret"))
    .use(RateLimitMiddleware(max_requests_per_minute=120))
    .plugin(AlertPlugin({"temperature": {"warning": 30, "critical": 40}}))
)
server.start()
from rise_l_net import RISELDevice
from rise_l_net.client import RetryMiddleware, ThrottleMiddleware, CacheMiddleware

device = (
    RISELDevice("http://server:8080")
    .use(RetryMiddleware(max_retries=5))
    .use(ThrottleMiddleware(max_requests_per_second=2))
    .use(CacheMiddleware(cache_path="/data/cache.json"))
)
device.start()

API surface

Endpoint Direction Body
POST /api/heartbeat client → server {device_id, ip, uptime, version, metadata}
POST /api/report client → server {device_id, event_type, data, severity, timestamp}
POST /<custom> client → server Anything you handle in server.route(...)

Authentication is opt-in via AuthMiddleware. The middleware uses a constant-time comparison and the header lookup is case-insensitive.

Logging

Library logs go through the rise_l_net logger. To enable a default stderr handler:

from rise_l_net import configure_logging
configure_logging("INFO")

If your application already configures logging, do not call configure_logging and the library will respect your handlers.

Development

git clone https://github.com/LXC-TRU/RISE.L.net.git
cd RISE.L.net
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
ruff check src tests
mypy src
pytest

License

MIT — see LICENSE.

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

rise_l_net-0.1.0.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

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

rise_l_net-0.1.0-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

Details for the file rise_l_net-0.1.0.tar.gz.

File metadata

  • Download URL: rise_l_net-0.1.0.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rise_l_net-0.1.0.tar.gz
Algorithm Hash digest
SHA256 15974d9ddfa9d80df09bcd72fac8e811bc00b170fb7d71dfc447e69fa35909aa
MD5 d171f2cf84718819d869956ea4555947
BLAKE2b-256 866d61a93b7e8415f3e05aab50fcc1c30a9f181787682018f9079b0278eeed3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rise_l_net-0.1.0.tar.gz:

Publisher: release.yml on LXC-TRU/RISE.L.net

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rise_l_net-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rise_l_net-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rise_l_net-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98e034d89b6d72db2d86ddd364180a5be518547b1b9db3b9bf185b79c4e7418f
MD5 4f3a5156608d81a92e0e04bc66a829ec
BLAKE2b-256 9b04180cc5127341d1c4da7f1ae7f3b197ba00e8f4bce3c2ccbe97d316c2ebad

See more details on using hashes here.

Provenance

The following attestation bundles were made for rise_l_net-0.1.0-py3-none-any.whl:

Publisher: release.yml on LXC-TRU/RISE.L.net

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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