Skip to main content

Pure python implementation of event dispatcher

Project description

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

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!

For more examples, please see examples

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

event_dispatching-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

event_dispatching-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file event_dispatching-0.1.1.tar.gz.

File metadata

  • Download URL: event_dispatching-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/5.15.0-76-generic

File hashes

Hashes for event_dispatching-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f5e1dea11694d37e01625593c455800d0d19cedfe26aabd5a1556d80b57751b8
MD5 3330402412e7be373b519f10d3628971
BLAKE2b-256 d04e46aa3b3aac0d5d630db498d7afc9be5fccd5969539eea36d0d84f1730123

See more details on using hashes here.

File details

Details for the file event_dispatching-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: event_dispatching-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/5.15.0-76-generic

File hashes

Hashes for event_dispatching-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94ffd4ae1ab2bbc35ae91cd8f5bd7c90b0bc1538d2e5a35b7c67dcde434eae18
MD5 180afb1ee3eb867c50623a82cac51445
BLAKE2b-256 bf6e62e1d77711286a95abf2b7a2ca7d1284bcb0dcb5dcf4a40b9bae21b828bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page