Skip to main content

Event Dispatcher

This repository contains a pure Python implementation of an event dispatcher. The event dispatcher allows you to create a simple event-driven architecture in your Python applications. It allows you to decouple your application components, making your code cleaner and easier to maintain.

Features

  • Pure Python: No external dependencies.
  • Simple API: Easy to understand and use.
  • Lightweight: Minimal impact on your application's performance.
  • Flexible: Can be used in any Python application.
  • Asyncio Support: Compatible with Python's built-in asyncio library.

Installation

You can install the Event Dispatcher using pip:

pip install event-dispatching

or using poetry

poetry add event-dispatching

Usage

Here is a basic example of how to use the Event Dispatcher:

import event_dispatcher

# Create an instance of the Event Dispatcher
dispatcher = event_dispatcher.SyncEventDispatcher()

# Define a callback function
def callback(data):
    print(f"Event received: {data}")

# Register the callback function for the "test" event
dispatcher.subscribe("test", callback)

# Dispatch the "test" event
dispatcher.dispatch("test", "Hello, World!")

When you run this code, it will print:

Event received: Hello, World!

More usage examples provided here

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for event-dispatching 0.2.0

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

Source distribution (sdist)

Source distribution for event-dispatching 0.2.0
File Size Uploaded
event_dispatching-0.2.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for event-dispatching 0.2.0
File Interpreter ABI Platform
event_dispatching-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / event_dispatching-0.2.0.tar.gz

Download URL event_dispatching-0.2.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
be43b0178988f42c71aabe33fae647e5f11afdfa3b18c3674e2466a2ffc82c49
BLAKE2b-256 checksum
How to use checksums
6307c876c3267c59758fd4f5ad61b258bc55accda81dba5043a6d3af6108052f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.16 Linux/5.15.0-1041-azure

Release files / event_dispatching-0.2.0-py3-none-any.whl

Download URL event_dispatching-0.2.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfd22e11abebd13df094172dba19ee173c555dce7ae9de82037f33eb5c634b65
BLAKE2b-256 checksum
How to use checksums
a84e6046fb4229c9e596ca487913e5dacaf866245cd9c931ba5daf93c1580b80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.16 Linux/5.15.0-1041-azure

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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