Skip to main content

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.

Metadata

Release files for aiodistbus 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiodistbus 0.0.2
File Size Uploaded Provenance
aiodistbus-0.0.2.tar.gz 33.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiodistbus 0.0.2
File Interpreter ABI Platform
aiodistbus-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 75.4 kB

Release files / aiodistbus-0.0.2.tar.gz

Download URL aiodistbus-0.0.2.tar.gz
Size 33.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1487e7416438b46c3855937eb59967c4943abfe3f26ff805c7f8e3d0e69a8bb4
BLAKE2b-256 checksum
How to use checksums
3fc6b9898aa21ca2fcc1a5a8e1108f1e553b6f28e26ac3772b01ee9a18aecb49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / aiodistbus-0.0.2-py3-none-any.whl

Download URL aiodistbus-0.0.2-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b768335b100d71ac9ed16f4a24ee2659bf9342bd75451bdce4450bff5eba5b6c
BLAKE2b-256 checksum
How to use checksums
54b4e5b5a16d292a6a791aa7b1f756f19ecf540209d5ea994a7ccd7a46d6f2b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for aiodistbus 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page