Name | aiodistbus JSON |
Version |
0.0.1
JSON |
| download |
home_page | |
Summary | ZeroMQ Distributed EventBus for Python |
upload_time | 2023-10-30 23:12:30 |
maintainer | |
docs_url | None |
author | |
requires_python | >3.6 |
license | |
keywords |
event
bus
distributed
observer
zeromq
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
![ChimeraPy/aiodistbus](https://github.com/ChimeraPy/aiodistbus/assets/40870026/306bff08-612c-4cc2-8354-e2407a4c9de1)
<p align="center">
<em>A Distributed Eventbus using ZeroMQ and AsyncIO for Python.</em>
</p>
<p align="center">
<a href="https://github.com/ChimeraPy/aiodistbus/actions?query=workflow%3ATest" target="_blank">
<img src="https://github.com/ChimeraPy/aiodistbus/workflows/Test/badge.svg" alt="Test">
</a>
<a href='https://coveralls.io/github/ChimeraPy/aiodistbus?branch=main'>
<img src='https://coveralls.io/repos/github/ChimeraPy/aiodistbus/badge.svg?branch=main' alt='Coverage Status' />
</a>
</p>
The objective of this library is to provide both a local and distributed eventbus that are compatible to communicate. A similar API can be used in both versions of the eventbuses implementations.
## Installation
For installing the package, download from PyPI and install with ``pip``:
```bash
pip install aiodistbus
```
Here is a link to the [Documentation](https://aiodistbus.readthedocs.io/en/latest/). If you encounter any issues in terms of code or documentation, please don't hesitate to make an issue.
## EventBus Example
The eventbus implementation follows a client-server design approach, with the ``DEventBus`` as the server and ``DEntryPoint`` as the client. Here is a quick example to emit an event.
```python
import asyncio
from dataclasses import dataclass
from dataclasses_json import DataClassJsonMixin # DO NOT FORGET THIS!
import aiodistbus as adb
@dataclass
class ExampleEvent(DataClassJsonMixin): # NEEDS TO BE A DataClassJsonMixin!
msg: str
async def handler(event: ExampleEvent):
print(event)
async def main():
# Create resources
bus, e1, e2 = adb.DEventBus(), adb.DEntryPoint(), adb.DEntryPoint()
# Connect
await e1.connect(bus.ip, bus.port)
await e2.connect(bus.ip, bus.port)
# Add funcs
await e1.on("test", handler, ExampleEvent)
# Send message
await e2.emit("test", ExampleEvent("hello"))
# Flush
await bus.flush()
# Close resources
await e1.close()
await e2.close()
await bus.close()
if __name__ == '__main__':
asyncio.run(main())
```
## Design
In the ``aiodistbus`` library, we provided 2 eventbus implementations: ``EventBus`` and ``DEventBus``. The ``EventBus`` class is for local (within same Python runtime) observer pattern. In the other hand, ``DEventBus`` class is for a distributed eventbus that leverages ZeroMQ -- closing following the [Clone pattern](https://zguide.zeromq.org/docs/chapter5/).
The Clone pattern uses a client-server structure, where a centralized broker broadcasts messages sent by clients. As described in the ZeroMQ Guide, this creates a single point of failure, but yields in a simpler and more scalable implementation.
## Contributing
Contributions are welcomed! Our [Developer Documentation](https://chimerapy.readthedocs.io/en/latest/developer/index.html) should provide more details in how ChimeraPy works and what is in current development.
## License
[ChimeraPy](https://github.com/ChimeraPy) and [ChimeraPy/aiodistbus](https://github.com/ChimeraPy/aiodistbus) uses the GNU GENERAL PUBLIC LICENSE, as found in [LICENSE](./LICENSE) file.
## Funding Info
This project is supported by the [National Science Foundation](https://www.nsf.gov/) under AI Institute Grant No. [DRL-2112635](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2112635&HistoricalAwards=false).
Raw data
{
"_id": null,
"home_page": "",
"name": "aiodistbus",
"maintainer": "",
"docs_url": null,
"requires_python": ">3.6",
"maintainer_email": "",
"keywords": "event,bus,distributed,observer,zeromq",
"author": "",
"author_email": "Eduardo Davalos <eduardo.davalos.anaya@vanderbilt.edu>, Umesh Timalsina <umesh.timalsina@vanderbilt.edu>",
"download_url": "https://files.pythonhosted.org/packages/a5/95/63b23128e3493ed487a66543933e5bf6de9113714a200d1d3f1bcf4b06f1/aiodistbus-0.0.1.tar.gz",
"platform": null,
"description": "![ChimeraPy/aiodistbus](https://github.com/ChimeraPy/aiodistbus/assets/40870026/306bff08-612c-4cc2-8354-e2407a4c9de1)\n<p align=\"center\">\n <em>A Distributed Eventbus using ZeroMQ and AsyncIO for Python.</em>\n</p>\n<p align=\"center\">\n<a href=\"https://github.com/ChimeraPy/aiodistbus/actions?query=workflow%3ATest\" target=\"_blank\">\n <img src=\"https://github.com/ChimeraPy/aiodistbus/workflows/Test/badge.svg\" alt=\"Test\">\n</a>\n\n<a href='https://coveralls.io/github/ChimeraPy/aiodistbus?branch=main'>\n <img src='https://coveralls.io/repos/github/ChimeraPy/aiodistbus/badge.svg?branch=main' alt='Coverage Status' />\n</a>\n</p>\n\nThe objective of this library is to provide both a local and distributed eventbus that are compatible to communicate. A similar API can be used in both versions of the eventbuses implementations.\n\n## Installation\n\nFor installing the package, download from PyPI and install with ``pip``:\n\n```bash\npip install aiodistbus\n```\n\nHere is a link to the [Documentation](https://aiodistbus.readthedocs.io/en/latest/). If you encounter any issues in terms of code or documentation, please don't hesitate to make an issue.\n\n## EventBus Example\n\nThe eventbus implementation follows a client-server design approach, with the ``DEventBus`` as the server and ``DEntryPoint`` as the client. Here is a quick example to emit an event.\n\n```python\nimport asyncio\nfrom dataclasses import dataclass\nfrom dataclasses_json import DataClassJsonMixin # DO NOT FORGET THIS!\n\nimport aiodistbus as adb\n\n@dataclass\nclass ExampleEvent(DataClassJsonMixin): # NEEDS TO BE A DataClassJsonMixin!\n msg: str\n\n\nasync def handler(event: ExampleEvent):\n print(event)\n\n\nasync def main():\n # Create resources\n bus, e1, e2 = adb.DEventBus(), adb.DEntryPoint(), adb.DEntryPoint()\n\n # Connect\n await e1.connect(bus.ip, bus.port)\n await e2.connect(bus.ip, bus.port)\n\n # Add funcs\n await e1.on(\"test\", handler, ExampleEvent)\n\n # Send message\n await e2.emit(\"test\", ExampleEvent(\"hello\"))\n\n # Flush\n await bus.flush()\n\n # Close resources\n await e1.close()\n await e2.close()\n await bus.close()\n\nif __name__ == '__main__':\n asyncio.run(main())\n```\n\n## Design\n\nIn the ``aiodistbus`` library, we provided 2 eventbus implementations: ``EventBus`` and ``DEventBus``. The ``EventBus`` class is for local (within same Python runtime) observer pattern. In the other hand, ``DEventBus`` class is for a distributed eventbus that leverages ZeroMQ -- closing following the [Clone pattern](https://zguide.zeromq.org/docs/chapter5/).\n\nThe Clone pattern uses a client-server structure, where a centralized broker broadcasts messages sent by clients. As described in the ZeroMQ Guide, this creates a single point of failure, but yields in a simpler and more scalable implementation.\n\n## Contributing\nContributions are welcomed! Our [Developer Documentation](https://chimerapy.readthedocs.io/en/latest/developer/index.html) should provide more details in how ChimeraPy works and what is in current development.\n\n## License\n[ChimeraPy](https://github.com/ChimeraPy) and [ChimeraPy/aiodistbus](https://github.com/ChimeraPy/aiodistbus) uses the GNU GENERAL PUBLIC LICENSE, as found in [LICENSE](./LICENSE) file.\n\n## Funding Info\nThis project is supported by the [National Science Foundation](https://www.nsf.gov/) under AI Institute Grant No. [DRL-2112635](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2112635&HistoricalAwards=false).\n",
"bugtrack_url": null,
"license": "",
"summary": "ZeroMQ Distributed EventBus for Python",
"version": "0.0.1",
"project_urls": {
"homepath": "https://github.com/ChimeraPy/aiodistbus",
"repository": "https://github.com/ChimeraPy/aiodistbus"
},
"split_keywords": [
"event",
"bus",
"distributed",
"observer",
"zeromq"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fea68b18d2ce51b8ad4d14fda5aeafd70b35505130f120cb194a36a594dface3",
"md5": "e67c876437f65e120fcb47df05ef4817",
"sha256": "3db96e2ca7f14b0c58808c1b80bb802eff77b6f52609e0a0b83b301004753e5b"
},
"downloads": -1,
"filename": "aiodistbus-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e67c876437f65e120fcb47df05ef4817",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">3.6",
"size": 41749,
"upload_time": "2023-10-30T23:12:28",
"upload_time_iso_8601": "2023-10-30T23:12:28.919666Z",
"url": "https://files.pythonhosted.org/packages/fe/a6/8b18d2ce51b8ad4d14fda5aeafd70b35505130f120cb194a36a594dface3/aiodistbus-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a59563b23128e3493ed487a66543933e5bf6de9113714a200d1d3f1bcf4b06f1",
"md5": "e4fd1b5c8b6c4c1eb55150178cd0258e",
"sha256": "0b81a566b3b18704512718836347b89e80ffebf668767d95a97db57783723f02"
},
"downloads": -1,
"filename": "aiodistbus-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "e4fd1b5c8b6c4c1eb55150178cd0258e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">3.6",
"size": 33173,
"upload_time": "2023-10-30T23:12:30",
"upload_time_iso_8601": "2023-10-30T23:12:30.989573Z",
"url": "https://files.pythonhosted.org/packages/a5/95/63b23128e3493ed487a66543933e5bf6de9113714a200d1d3f1bcf4b06f1/aiodistbus-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-30 23:12:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ChimeraPy",
"github_project": "aiodistbus",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "aiodistbus"
}