Skip to main content

A code generator for remote procedure calls on embedded systems

Project description

LotusRPC 🌼

Build & Test Code style: clang-format Static analysis: clang-tidy PyPI Python License: MIT Code Smells Coverage Security Rating Code style: Ruff linting: pylint Checked with mypy

Quality gate

RPC framework for embedded systems based on ETL. Define your interface once in YAML; LotusRPC generates all C++ server code and a Python client. No dynamic memory allocations, no exceptions, no RTTI.

graph LR
    C["Client\nPC · Python"] <-->|"function call / return"| T["Transport\nserial · BT · TCP · …"]
    T <-->|bytes| S["Server\nMCU · C++"]

Features

  • No dynamic memory — stack-only, no heap, no exceptions, no RTTI
  • Transport agnostic — any byte-oriented channel (serial, Bluetooth, TCP, …)
  • YAML definitions — schema-validated, editor-friendly, easy to parse or extend
  • Code generationlrpcg produces all C++ server code in one command
  • CLI clientlrpcc lets any team member call remote functions without writing code
  • Streams — client-to-server and server-to-client data streams, finite or infinite
  • C++11 compatible — works on any platform with a modern C++ compiler

Quick start

Install:

pip install lotusrpc

Define your interface (math.lrpc.yaml):

[!NOTE] By convention, LotusRPC definition files use the .lrpc.yaml extension.

name: math
settings:
  namespace: ex
services:
  - name: calc
    functions:
      - name: add
        params:
          - { name: a, type: int32_t }
          - { name: b, type: int32_t }
        returns:
          - { name: result, type: int32_t }

Generate C++ server code:

lrpcg cpp -d math.lrpc.yaml -o generated/

Implement the server — derive from the generated shim and implement the pure virtual function:

#include "math/math.hpp"

class CalcService : public ex::calc_shim
{
protected:
    int32_t add(int32_t a, int32_t b) override
    {
        return a + b;
    }
};

Subclass the generated server to provide a transport, register your service, and feed incoming bytes:

class MathServer : public ex::math
{
    void lrpcTransmit(lrpc::span<const uint8_t> bytes) override
    {
        uart_write(bytes.data(), bytes.size());  // your hardware here
    }
};

CalcService calc;
MathServer server;
server.registerService(calc);

// In your receive loop:
server.lrpcReceive(incoming_byte);

Call from the command line:

lrpcc calc add 3 7   # result = 10

Documentation

Full documentation is at tzijnge.github.io/LotusRpc, including:

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

lotusrpc-1.0.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

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

lotusrpc-1.0.0-py3-none-any.whl (76.1 kB view details)

Uploaded Python 3

File details

Details for the file lotusrpc-1.0.0.tar.gz.

File metadata

  • Download URL: lotusrpc-1.0.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lotusrpc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 84ad150f752a52b7a7d3666570c9badafc6fd3213f2139d1393a75df2adc697e
MD5 5f977d77cc16d5fd600be263e120538c
BLAKE2b-256 3e0545edef88e304484580af2dcb7273070517e12426aa95538e04edc8bcff52

See more details on using hashes here.

Provenance

The following attestation bundles were made for lotusrpc-1.0.0.tar.gz:

Publisher: publish-to-pypi.yml on tzijnge/LotusRpc

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

File details

Details for the file lotusrpc-1.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for lotusrpc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39d0a1263860b7511da973254c39929b428c05a4db8be6e3b95879ed4868d1ea
MD5 0e8863ee46a528b3717e79e1227ae7f3
BLAKE2b-256 e54f3383e4bb38531d2c9d4b33a519fc1a413c1d225b63c976aafb794ee9c209

See more details on using hashes here.

Provenance

The following attestation bundles were made for lotusrpc-1.0.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on tzijnge/LotusRpc

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