Catalog PyPI
Back to packageRELEASE DETAILS

0.0.2

PyPI

aiodistbus

ZeroMQ Distributed EventBus for Python

busdistributedeventobserverzeromq
Published1 Nov 2023
Direct dependencies15
Transitive dependenciesNot calculated

README

Version 0.0.2 documentation

ChimeraPy/aiodistbus

A Distributed Eventbus using ZeroMQ and AsyncIO for Python.

Test Coverage Status

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:

pip install aiodistbus

Here is a link to the Documentation. 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.

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.

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 should provide more details in how ChimeraPy works and what is in current development.

License

ChimeraPy and ChimeraPy/aiodistbus uses the GNU GENERAL PUBLIC LICENSE, as found in LICENSE file.

Funding Info

This project is supported by the National Science Foundation under AI Institute Grant No. DRL-2112635.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 15

Native requirements
15 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
asyncio-atexit
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
asyncio-atexitruntime
pyzmq
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
pyzmqruntime
dataclasses-json
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
dataclasses-jsonruntime
aioreactive
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
aioreactiveruntime
uvloop
Environment
{
  "extras": "",
  "marker": "sys_platform != \"win32\"",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
uvloop ; sys_platform != "win32"runtime
winloop
Environment
{
  "extras": "",
  "marker": "sys_platform == \"win32\"",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
winloop ; sys_platform == "win32"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
pytest ; extra == 'test'runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio ; extra == 'test'runtime
pytest-repeat
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
pytest-repeat ; extra == 'test'runtime
pytest-lazy-fixture
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
pytest-lazy-fixture ; extra == 'test'runtime
pytest-rerunfailures
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
pytest-rerunfailures ; extra == 'test'runtime
auto-changelog
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
auto-changelog ; extra == 'test'runtime
coveralls
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
coveralls ; extra == 'test'runtime
pre-commit
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
pre-commit ; extra == 'test'runtime
bump2version
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">3.6",
  "evaluation": "NOT_EVALUATED"
}
bump2version ; extra == 'test'runtime

Distribution files

2 collected
aiodistbus-0.0.2-py3-none-any.whl

bdist_wheel · 41 KB · Python py3

Source file
aiodistbus-0.0.2.tar.gz

sdist · 32.59 KB · Python source

Source file

Repository

PENDING
chimerapy/aiodistbus

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:49 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:9d1ce5986f760a25e6ffa5eab9cebbd53dcb9c7743ff0e911527ada8960e105a

Other collected versions

View all collected versions →