compas-eve


Namecompas-eve JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttps://github.com/compas-dev/compas_eve
SummaryCOMPAS Event Extensions: adds event-based communication infrastructure to the COMPAS framework.
upload_time2025-10-30 11:20:11
maintainerNone
docs_urlNone
authorGonzalo Casas
requires_python>=3.8
licenseMIT License Copyright (c) 2023 Gramazio Kohler Research Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords events event-driven compas architecture distributed systems
VCS
bugtrack_url
requirements compas paho-mqtt
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # COMPAS EVE

Event-based communication for the COMPAS framework.

```python
>>> import compas_eve as eve
>>> pub = eve.Publisher("/hello_world")
>>> sub = eve.EchoSubscriber("/hello_world")
>>> sub.subscribe()
>>> for i in range(10):
...    pub.publish(dict(text=f"Hello World {i}"))
```

It is extremely easy to send messages around. COMPAS EVE supports
different transport mechanisms to send messages between different threads, processes, computers, etc.

## Installation

Install using `pip`:

```bash

    pip install compas_eve
```

Or using `conda`:

```bash

    conda install compas_eve
```

## Supported features

* Publisher/subscriber communication model (N-to-N communication)
* In-process events
* MQTT support
* Extensible codec system for message serialization (JSON, Protocol Buffers)

## Examples

### In-process events

The simplest option is to use in-process events. This works for
simple applications and allows to communicate between threads.

```python
import compas_eve as eve

pub = eve.Publisher("/hello_world")
sub = eve.EchoSubscriber("/hello_world")
sub.subscribe()

for i in range(10):
    pub.publish(dict(text=f"Hello World {i}"))
```

### MQTT

MQTT is a protocol that allows to send messages between different
systems/computers. Using MQTT is very simple as well:

```python
import compas_eve as eve
from compas_eve.mqtt import MqttTransport

tx = MqttTransport("broker.hivemq.com")
eve.set_default_transport(tx)

pub = eve.Publisher("/hello_world")
sub = eve.EchoSubscriber("/hello_world")
sub.subscribe()

for i in range(10):
    pub.publish(dict(text=f"Hello World {i}"))
```

This example shows how to send and receive from a single script, but
running publishers and subscribers on different scripts, different processes, or even different computers will work the exact same way.

### Using different codecs

By default, COMPAS EVE uses JSON for message serialization. However, you can use different codecs for more efficient serialization:

```python
import compas_eve as eve
from compas_eve import JsonMessageCodec
from compas_eve.codecs import ProtobufMessageCodec
from compas_eve.mqtt import MqttTransport

# Use JSON codec (default)
json_codec = JsonMessageCodec()
tx = MqttTransport("broker.hivemq.com", codec=json_codec)

# Or use Protocol Buffers for binary serialization (requires compas_pb)
pb_codec = ProtobufMessageCodec()
tx = MqttTransport("broker.hivemq.com", codec=pb_codec)
```


### Usage from Rhinoceros 3D

It is possible to use the same code from within Rhino/Grasshopper.

To install `compas_eve`, use the the syntax `# r: compas_eve` at the top of any Python 3.x script in Rhino/Grasshopper.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/compas-dev/compas_eve",
    "name": "compas-eve",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "events, event-driven, compas, architecture, distributed systems",
    "author": "Gonzalo Casas",
    "author_email": "Gonzalo Casas <casas@arch.ethz.ch>, Chen Kasirer <kasirer@arch.ethz.ch>",
    "download_url": "https://files.pythonhosted.org/packages/8a/ee/e35f4b1d00e94da92e02860290478cfde748ab7c538e5db93fbc2c38bd94/compas_eve-2.0.0.tar.gz",
    "platform": null,
    "description": "# COMPAS EVE\r\n\r\nEvent-based communication for the COMPAS framework.\r\n\r\n```python\r\n>>> import compas_eve as eve\r\n>>> pub = eve.Publisher(\"/hello_world\")\r\n>>> sub = eve.EchoSubscriber(\"/hello_world\")\r\n>>> sub.subscribe()\r\n>>> for i in range(10):\r\n...    pub.publish(dict(text=f\"Hello World {i}\"))\r\n```\r\n\r\nIt is extremely easy to send messages around. COMPAS EVE supports\r\ndifferent transport mechanisms to send messages between different threads, processes, computers, etc.\r\n\r\n## Installation\r\n\r\nInstall using `pip`:\r\n\r\n```bash\r\n\r\n    pip install compas_eve\r\n```\r\n\r\nOr using `conda`:\r\n\r\n```bash\r\n\r\n    conda install compas_eve\r\n```\r\n\r\n## Supported features\r\n\r\n* Publisher/subscriber communication model (N-to-N communication)\r\n* In-process events\r\n* MQTT support\r\n* Extensible codec system for message serialization (JSON, Protocol Buffers)\r\n\r\n## Examples\r\n\r\n### In-process events\r\n\r\nThe simplest option is to use in-process events. This works for\r\nsimple applications and allows to communicate between threads.\r\n\r\n```python\r\nimport compas_eve as eve\r\n\r\npub = eve.Publisher(\"/hello_world\")\r\nsub = eve.EchoSubscriber(\"/hello_world\")\r\nsub.subscribe()\r\n\r\nfor i in range(10):\r\n    pub.publish(dict(text=f\"Hello World {i}\"))\r\n```\r\n\r\n### MQTT\r\n\r\nMQTT is a protocol that allows to send messages between different\r\nsystems/computers. Using MQTT is very simple as well:\r\n\r\n```python\r\nimport compas_eve as eve\r\nfrom compas_eve.mqtt import MqttTransport\r\n\r\ntx = MqttTransport(\"broker.hivemq.com\")\r\neve.set_default_transport(tx)\r\n\r\npub = eve.Publisher(\"/hello_world\")\r\nsub = eve.EchoSubscriber(\"/hello_world\")\r\nsub.subscribe()\r\n\r\nfor i in range(10):\r\n    pub.publish(dict(text=f\"Hello World {i}\"))\r\n```\r\n\r\nThis example shows how to send and receive from a single script, but\r\nrunning publishers and subscribers on different scripts, different processes, or even different computers will work the exact same way.\r\n\r\n### Using different codecs\r\n\r\nBy default, COMPAS EVE uses JSON for message serialization. However, you can use different codecs for more efficient serialization:\r\n\r\n```python\r\nimport compas_eve as eve\r\nfrom compas_eve import JsonMessageCodec\r\nfrom compas_eve.codecs import ProtobufMessageCodec\r\nfrom compas_eve.mqtt import MqttTransport\r\n\r\n# Use JSON codec (default)\r\njson_codec = JsonMessageCodec()\r\ntx = MqttTransport(\"broker.hivemq.com\", codec=json_codec)\r\n\r\n# Or use Protocol Buffers for binary serialization (requires compas_pb)\r\npb_codec = ProtobufMessageCodec()\r\ntx = MqttTransport(\"broker.hivemq.com\", codec=pb_codec)\r\n```\r\n\r\n\r\n### Usage from Rhinoceros 3D\r\n\r\nIt is possible to use the same code from within Rhino/Grasshopper.\r\n\r\nTo install `compas_eve`, use the the syntax `# r: compas_eve` at the top of any Python 3.x script in Rhino/Grasshopper.\r\n",
    "bugtrack_url": null,
    "license": "MIT License\r\n        \r\n        Copyright (c) 2023 Gramazio Kohler Research\r\n        \r\n        Permission is hereby granted, free of charge, to any person obtaining a copy\r\n        of this software and associated documentation files (the \"Software\"), to deal\r\n        in the Software without restriction, including without limitation the rights\r\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n        copies of the Software, and to permit persons to whom the Software is\r\n        furnished to do so, subject to the following conditions:\r\n        \r\n        The above copyright notice and this permission notice shall be included in all\r\n        copies or substantial portions of the Software.\r\n        \r\n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n        SOFTWARE.\r\n        ",
    "summary": "COMPAS Event Extensions: adds event-based communication infrastructure to the COMPAS framework.",
    "version": "2.0.0",
    "project_urls": {
        "Changelog": "https://github.com/compas-dev/compas_eve/blob/main/CHANGELOG.md",
        "Documentation": "https://compas.dev/compas_eve",
        "Forum": "https://forum.compas-framework.org/",
        "Homepage": "https://github.com/compas-dev/compas_eve",
        "Issues": "https://github.com/compas-dev/compas_eve/issues",
        "Repository": "https://github.com/compas-dev/compas_eve"
    },
    "split_keywords": [
        "events",
        " event-driven",
        " compas",
        " architecture",
        " distributed systems"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4bd795c18fa488ec6c22663f837ce22a02e95d05ef21cc02b74f6e0fd95b5d3e",
                "md5": "02b8bba8f9856ed548d6f1e55c564e01",
                "sha256": "a6982250d6f2d9f881a18a92ec6b995bec5e097068f0af98abad49b925a7701b"
            },
            "downloads": -1,
            "filename": "compas_eve-2.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "02b8bba8f9856ed548d6f1e55c564e01",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 52921,
            "upload_time": "2025-10-30T11:20:10",
            "upload_time_iso_8601": "2025-10-30T11:20:10.289628Z",
            "url": "https://files.pythonhosted.org/packages/4b/d7/95c18fa488ec6c22663f837ce22a02e95d05ef21cc02b74f6e0fd95b5d3e/compas_eve-2.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8aeee35f4b1d00e94da92e02860290478cfde748ab7c538e5db93fbc2c38bd94",
                "md5": "5b036de1705567a61e1023cb7e0551ef",
                "sha256": "388ee06e913c50fcba9756271726ccb7e95020099607a854ceeb31cadfbca030"
            },
            "downloads": -1,
            "filename": "compas_eve-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5b036de1705567a61e1023cb7e0551ef",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 50670,
            "upload_time": "2025-10-30T11:20:11",
            "upload_time_iso_8601": "2025-10-30T11:20:11.607844Z",
            "url": "https://files.pythonhosted.org/packages/8a/ee/e35f4b1d00e94da92e02860290478cfde748ab7c538e5db93fbc2c38bd94/compas_eve-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-30 11:20:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "compas-dev",
    "github_project": "compas_eve",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "compas",
            "specs": [
                [
                    ">=",
                    "1.17.6"
                ]
            ]
        },
        {
            "name": "paho-mqtt",
            "specs": [
                [
                    ">=",
                    "1"
                ],
                [
                    "<",
                    "3"
                ]
            ]
        }
    ],
    "lcname": "compas-eve"
}
        
Elapsed time: 1.76804s