compost-rpc


Namecompost-rpc JSON
Version 0.6.0 PyPI version JSON
download
home_pageNone
SummaryCompost RPC protocol generator
upload_time2025-07-14 12:36:06
maintainerNone
docs_urlNone
authorRadovan Blažek, Petr Moucha
requires_python>=3.10
licenseNone
keywords protocol rpc mcu embedded
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Compost

Compost is a Remote Procedure Call ([RPC](https://en.wikipedia.org/wiki/Remote_procedure_call))
protocol generator with a simple wire format.

It abstracts communication between a PC and an MCU. Basically it allows you to
call functions on your MCU from a PC.

Compost is meant to be used over any medium, but it's simplicity is best suited
for UART/RS232 or UDP/IP.

## Install

    pip install compost_rpc

## Documentation

Documentation is available in the [Wiki](https://github.com/STMicroelectronics/compost-rpc/wiki)

## Introduction

With Compost you can write a function for your MCU in C, but call
it from Python or C# on a PC.

The call on the PC looks like a normal function
call, but Compost takes the arguments, creates a message and sends it
over a transport like serial port. Then, Compost on the MCU parses the message
and calls your function with the arguments you provided on the PC.
Your function returns a value. Compost on the MCU creates a response message
with the return value. The response is sent to PC. Compost on the PC parses the
message and the function you called on the PC returns the value you provided in
the MCU.

Simplified functionality diagram:

![Functional overview](docs/_static/image/getting_started/compost-simple.svg)

## Features

### Languge support

- C
  - C11 standard
  - Implemented roles
    - RPC server (callee)
    - Notification sender
    - Notification receiver
- Python
  - Needs version >= 3.10
  - Implemented roles
    - RPC client (caller)
    - Notification receiver
- C#
  - Implemented roles
    - RPC client (caller)
    - Notification receiver

### Transports

- UDP transport
- Serial transport
- Raw ethernet transport (Linux only)
- TCP transport
- Stdio transport
- Custom

### Data types

- 8, 16, 32 and 64-bit signed and unsigned integers
- 32 and 64-bit floating-point numbers (IEEE 754)
- Bit-precise integers
- C like Struct
- C like Enum with selectable underlying type
- Dynamically sized array (list) for each supported primitive type

## Try it!

You just need Python and a C compiler like GCC to run our single PC example.

Clone the repository and enter the directory with the example:

    git clone https://github.com/STMicroelectronics/compost-rpc.git
    cd compost-rpc/examples/pc_to_pc

Generate C code from the protocol definition:

    python protocol_def.py

Compile the server:

On Linux or macOS:

    gcc -o server main.c compost.c

On Windows:

    gcc -o server main.c compost.c -lws2_32

In one terminal run the C server:

    ./server

In another terminal run the Python client:

    python main.py

Client sends two integers and the server adds them together and sends the result back to the client.
It's probably the simplest Compost example you can have.

If you want to try Compost-RPC properly with an MCU, check out
the [Tutorial](https://github.com/STMicroelectronics/compost-rpc/wiki/Tutorial).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "compost-rpc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "protocol, RPC, MCU, embedded",
    "author": "Radovan Bla\u017eek, Petr Moucha",
    "author_email": "Radovan Bla\u017eek <radovan.blazek@st.com>, Petr Moucha <petr.moucha@st.com>",
    "download_url": "https://files.pythonhosted.org/packages/aa/59/4c9c8d29c27c72ad292d1014239053afc2b78a0ce666e84112ecedc3902a/compost_rpc-0.6.0.tar.gz",
    "platform": null,
    "description": "# Compost\n\nCompost is a Remote Procedure Call ([RPC](https://en.wikipedia.org/wiki/Remote_procedure_call))\nprotocol generator with a simple wire format.\n\nIt abstracts communication between a PC and an MCU. Basically it allows you to\ncall functions on your MCU from a PC.\n\nCompost is meant to be used over any medium, but it's simplicity is best suited\nfor UART/RS232 or UDP/IP.\n\n## Install\n\n    pip install compost_rpc\n\n## Documentation\n\nDocumentation is available in the [Wiki](https://github.com/STMicroelectronics/compost-rpc/wiki)\n\n## Introduction\n\nWith Compost you can write a function for your MCU in C, but call\nit from Python or C# on a PC.\n\nThe call on the PC looks like a normal function\ncall, but Compost takes the arguments, creates a message and sends it\nover a transport like serial port. Then, Compost on the MCU parses the message\nand calls your function with the arguments you provided on the PC.\nYour function returns a value. Compost on the MCU creates a response message\nwith the return value. The response is sent to PC. Compost on the PC parses the\nmessage and the function you called on the PC returns the value you provided in\nthe MCU.\n\nSimplified functionality diagram:\n\n![Functional overview](docs/_static/image/getting_started/compost-simple.svg)\n\n## Features\n\n### Languge support\n\n- C\n  - C11 standard\n  - Implemented roles\n    - RPC server (callee)\n    - Notification sender\n    - Notification receiver\n- Python\n  - Needs version >= 3.10\n  - Implemented roles\n    - RPC client (caller)\n    - Notification receiver\n- C#\n  - Implemented roles\n    - RPC client (caller)\n    - Notification receiver\n\n### Transports\n\n- UDP transport\n- Serial transport\n- Raw ethernet transport (Linux only)\n- TCP transport\n- Stdio transport\n- Custom\n\n### Data types\n\n- 8, 16, 32 and 64-bit signed and unsigned integers\n- 32 and 64-bit floating-point numbers (IEEE 754)\n- Bit-precise integers\n- C like Struct\n- C like Enum with selectable underlying type\n- Dynamically sized array (list) for each supported primitive type\n\n## Try it!\n\nYou just need Python and a C compiler like GCC to run our single PC example.\n\nClone the repository and enter the directory with the example:\n\n    git clone https://github.com/STMicroelectronics/compost-rpc.git\n    cd compost-rpc/examples/pc_to_pc\n\nGenerate C code from the protocol definition:\n\n    python protocol_def.py\n\nCompile the server:\n\nOn Linux or macOS:\n\n    gcc -o server main.c compost.c\n\nOn Windows:\n\n    gcc -o server main.c compost.c -lws2_32\n\nIn one terminal run the C server:\n\n    ./server\n\nIn another terminal run the Python client:\n\n    python main.py\n\nClient sends two integers and the server adds them together and sends the result back to the client.\nIt's probably the simplest Compost example you can have.\n\nIf you want to try Compost-RPC properly with an MCU, check out\nthe [Tutorial](https://github.com/STMicroelectronics/compost-rpc/wiki/Tutorial).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Compost RPC protocol generator",
    "version": "0.6.0",
    "project_urls": {
        "Issues": "https://github.com/STMicroelectronics/compost-rpc/issues",
        "Source": "https://github.com/STMicroelectronics/compost-rpc",
        "documentation": "https://github.com/STMicroelectronics/compost-rpc/wiki"
    },
    "split_keywords": [
        "protocol",
        " rpc",
        " mcu",
        " embedded"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "69a36fb2e4a93a8c483ffd0d7977637744304b14a8231857b752064e46eeaaa6",
                "md5": "c577a67ffcf49863f6b4d5c7d07e83ef",
                "sha256": "041c0017421a43703875c39df852b0fa982f7663de00f6e136fe761edf806096"
            },
            "downloads": -1,
            "filename": "compost_rpc-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c577a67ffcf49863f6b4d5c7d07e83ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 28333,
            "upload_time": "2025-07-14T12:36:04",
            "upload_time_iso_8601": "2025-07-14T12:36:04.886736Z",
            "url": "https://files.pythonhosted.org/packages/69/a3/6fb2e4a93a8c483ffd0d7977637744304b14a8231857b752064e46eeaaa6/compost_rpc-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "aa594c9c8d29c27c72ad292d1014239053afc2b78a0ce666e84112ecedc3902a",
                "md5": "eaad908ad714625ec248cd7413ac77f5",
                "sha256": "66b32f8e8ecfee99ee360156fe76bcf83e72142941677d8f515b0411b3098fdb"
            },
            "downloads": -1,
            "filename": "compost_rpc-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "eaad908ad714625ec248cd7413ac77f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 26277,
            "upload_time": "2025-07-14T12:36:06",
            "upload_time_iso_8601": "2025-07-14T12:36:06.238246Z",
            "url": "https://files.pythonhosted.org/packages/aa/59/4c9c8d29c27c72ad292d1014239053afc2b78a0ce666e84112ecedc3902a/compost_rpc-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-14 12:36:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "STMicroelectronics",
    "github_project": "compost-rpc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "compost-rpc"
}
        
Elapsed time: 2.25297s