Skip to main content

A simple event queue library with support for topics.

Project description

evque: Event Queue with Topics

PyPI version License: GPL v3

evque is a Python library that provides a simple event queue with support for topics. It allows you to manage events published to different topics and deliver them to their respective event handlers based on their delivery time.

Installation

You can install evque from PyPI using pip:

pip install evque

Features

  • Event Queue: Manage events and their delivery times in a priority queue.
  • Topic Support: Subscribe and publish events to different topics.
  • Singleton Instance: Share a single event queue instance across modules in your application.

Usage

from evque import subscribe, publish, run_until, empty, increase_clock, reset_clock, now

# Subscribe to a topic
def event_handler(arg):
    print(f"Event received with argument: {arg}")

subscribe('topic1', event_handler)

# Publish an event to be delivered at time 10
publish('topic1', 10, "Hello, World!")

# Run events until time 15
run_until(15)

# Check if there are undelivered events in the queue
if empty():
    print("No undelivered events in the queue.")

License

This library is licensed under the GNU General Public License v3.0. For more details, see the LICENSE.txt file.

Contributing

Contributions to evque are welcome! If you find any issues or have suggestions for improvements, please open an issue or create a pull request on the GitHub repository.

Acknowledgements

The "evque" library is inspired by the concept of event queues used in discrete event simulation and event-driven programming.

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

evque-1.2.0.tar.gz (15.7 kB view hashes)

Uploaded Source

Supported by

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