Skip to main content

A Python client for RTMA/Dragonfly

Project description

pyrtma

Python package Documentation Status

RTMA/Dragonfly client written in python with no external dependencies. Based on and compatible with Dragonfly Messaging

Installation

pyrtma is available on PyPI

pip install pyrtma

Installing for pyrtma development

This is only necessary for individuals who would like to contribute to pyrtma.

pip install --upgrade pip setuptools
pip install -e .

Usage

Launch Manager

python -m pyrtma.manager -a "127.0.0.1"

Create a message in message.yaml

Message definitions are created in a .yaml file.

The ruamel.yaml parser library is used internally (https://yaml.readthedocs.io/en/latest/)

Notes about yaml format:

  • Whitespace sensitive. Use either 2 or 4 spaces for tab not '\t'
  • Key-values must be separated by a colon followed by a space, (Key: Value, not Key:Value)
  • Must follow the top-level headers shown below.
  • Unused sections should be marked null
  • Names must start with letter. (no _ or numeric prefixes allowed)
  • Use (.yaml) extension not (.yml)

List of supported native data types:

  • char
  • unsigned char
  • byte
  • int
  • signed int
  • unsigned int
  • short
  • unsigned short
  • long
  • signed long
  • unsigned long
  • long long
  • signed long long
  • unsigned long long
  • float
  • double
  • int8
  • uint8
  • int16
  • uint16
  • int32
  • uint32
  • int64
  • uint64

Below is an example:

# message.yaml

imports: null

# Constant values and expressions
constants: 
    STR_SIZE: 32
    LONG_STRING: STR_SIZE * 2

# Constant string values
string_constants:
    default_msg: "hello_world"

host_ids: null

module_ids:
    PERSON_PUBLISHER: 212
    PERSON_SUBSCRIBER: 214

# Alias a type by another name
aliases:
    AGE_TYPE: int

# Non-message structured data (no id field)
struct_defs:
    TEST_STRUCT:
        fields:
            value_str: char[STR_SIZE]
            value_int: int

# Message defintions with user assigned id field
message_defs:
    PERSON_MESSAGE:
        id: 1234
        fields:
            name: char[STR_SIZE]
            age: AGE_TYPE

    ANOTHER_EXAMPLE:
        id: 5678
        fields:
            value_struct: TEST_STRUCT
            value_float: float
            value_double: double

    # Example signal definition
    USER_SIGNAL:
        id: 2468
        fields: null

    # Example using a nested message defintion 
    PERSON_LIST:
        id: 1357
        fields:
            person: PERSON_MESSAGE[32]

    # Example reusing a message definition by another name
    EMPLOYEES:
        id: 1368
        fields: PERSON_LIST

    # A block of message ids can be reserved by a file for future use
    # Ranges are inclusive on both ends
    _RESERVED_:
        id: [1000, 1002:1005, 1006 - 1008, 1009 to 1012]

Run the following command to compile the yaml file into Python, C, Matlab, or Javascript files. This will output a message.(py|h|m|js) file.

python -m pyrtma.compile -i examples/msg_defs/message.yaml --py --c --mat --js

The msg_defs directory should now have message def files created for each language.

The rtma objects are compiled into objects suitable for each language.

Examples

See /examples/example.py for pub/sub demo app

Compile the example message defintions:

python -m pyrtma.compile -i ./examples/msg_defs/message.yaml --py

Start the demo MessageManager server

python -m pyrtma.manager

Start the publisher in one console:

python ./examples/example.py --pub

Start the subscriber in another:

python ./examples/example.py --sub

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

pyrtma-2.0.6.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

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

pyrtma-2.0.6-py3-none-any.whl (47.3 kB view details)

Uploaded Python 3

File details

Details for the file pyrtma-2.0.6.tar.gz.

File metadata

  • Download URL: pyrtma-2.0.6.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pyrtma-2.0.6.tar.gz
Algorithm Hash digest
SHA256 3f68e570bf9804341814bbceb09b273df8f2c3905e0d287db89c585a93a94f23
MD5 d24c7072bc0c4e40e9f743d883a1f770
BLAKE2b-256 f192b559554025858478f450d12f09e9f736bf43e3dd28a7f2ff432206deb682

See more details on using hashes here.

File details

Details for the file pyrtma-2.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyrtma-2.0.6-py3-none-any.whl
  • Upload date:
  • Size: 47.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pyrtma-2.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 68a30eba09b92c6e67d24e7e8f72ca186e42e57098d389d1480b8f53df6e1a7e
MD5 604a60cc3aa43d506ff5c8559fdf5a8e
BLAKE2b-256 e591f5b9731c3614023af9068da2c0c6efcd51b7750be878378fd11d3502e222

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