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.4.1.tar.gz (15.7 kB view details)

Uploaded Source

File details

Details for the file evque-1.4.1.tar.gz.

File metadata

  • Download URL: evque-1.4.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for evque-1.4.1.tar.gz
Algorithm Hash digest
SHA256 ef6c9fd747a41588fea47f9df84773842fd479bdb9f42c73df2a0ec2879444cc
MD5 1a3d9f026077d7dfaa175bf39e9130a8
BLAKE2b-256 46cad640637fdef528cb03da597dfdc8f659b449f04b25891aa3ae0d0f2476c2

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