{"id":24836925,"url":"https://github.com/wqking/eventpy","last_synced_at":"2025-10-14T11:31:46.597Z","repository":{"id":57427297,"uuid":"240659759","full_name":"wqking/eventpy","owner":"wqking","description":"Event Dispatcher and callback list for Python","archived":false,"fork":false,"pushed_at":"2020-02-17T06:59:28.000Z","size":155,"stargazers_count":44,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T19:41:51.367Z","etag":null,"topics":["callback","event-dispatcher","nested-events","observe-pattern","publish-subscribe","python","signal","slot","thread-safe"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wqking.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-15T06:57:31.000Z","updated_at":"2024-12-02T11:48:45.000Z","dependencies_parsed_at":"2022-09-19T06:30:18.634Z","dependency_job_id":null,"html_url":"https://github.com/wqking/eventpy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqking%2Feventpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqking%2Feventpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqking%2Feventpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqking%2Feventpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wqking","download_url":"https://codeload.github.com/wqking/eventpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236470412,"owners_count":19153859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["callback","event-dispatcher","nested-events","observe-pattern","publish-subscribe","python","signal","slot","thread-safe"],"created_at":"2025-01-31T05:48:38.204Z","updated_at":"2025-10-14T11:31:41.257Z","avatar_url":"https://github.com/wqking.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eventpy -- Python library for event dispatcher and callback list\n\neventpy is a Python event library that provides tools that enable your application components to communicate with each other by dispatching events and listening for them. With eventpy you can easily implement signal/slot mechanism, or observer pattern.  \nThis library is the Python version rewritten from the C++ library [eventpp](https://github.com/wqking/eventpp), both are developed by the same developer.\n\n## Facts and features\n\n- **Powerful**\n  - Supports synchronous event dispatching and asynchronous event queue.\n  - Configurable and extensible with policies.\n- **Robust**\n  - Supports nested event. During the process of handling an event, a listener can safely dispatch event and append/prepend/insert/remove other listeners.\n  - Thread safety. Supports multi-threading.\n  - Well tested. Backed by unit tests.\n- **Flexible and easy to use**\n  - Listeners and events can be of any type and do not need to be inherited from any base class.\n  - Requires Python 3. Tested with Python 3.7 and Cython.\n\n## License\n\nApache License, Version 2.0  \n\n## Version 0.0.1\n\neventpy is currently usable and stable.\n\n## Source code\n\n[https://github.com/wqking/eventpy](https://github.com/wqking/eventpy)\n\n## Quick start\n\n### Install\n\n`pip install eventpy`\n\n### Package\n\n`eventpy`\n\n### Using CallbackList\n```python\n# create a CallbackList\ncallbackList = CallbackList()\ncallbackList.append(lambda s, b : print(\"Got callback 1, s is %s b is %d\" % (s, b)))\ndef anotherCallback(s, b) :\n\tprint(\"Got callback 2, s is %s b is %d\" % (s, b))\ncallbackList.append(anotherCallback)\n# Invoke the callback list\ncallbackList(\"Hello world\", True)\n```\n\n### Using EventDispatcher\n```python\n# create an EventDispatcher\ndispatcher = EventDispatcher()\n\ndispatcher.appendListener(3, lambda s, b : print(\"Got event 3, s is %s b is %d\" % (s, b)))\ndispatcher.appendListener(5, lambda s, b : print(\"Got event 5, s is %s b is %d\" % (s, b)))\ndispatcher.appendListener(5, lambda s, b : print(\"Got another event 5, s is %s b is %d\" % (s, b)))\n\n# Dispatch the events, the first argument is always the event type.\ndispatcher.dispatch(3, \"Hello\", True)\ndispatcher.dispatch(5, \"World\", False)\n```\n\n### Using EventQueue\n```python\n# create an EventQueue\nqueue = eventqueue.EventQueue()\nqueue.appendListener(3, lambda s, n : print(\"Got event 3, s is %s n is %d\" % (s, n)))\nqueue.appendListener(5, lambda s, n : print(\"Got event 5, s is %s n is %d\" % (s, n)))\nqueue.appendListener(5, lambda s, n : print(\"Got another event 5, s is %s n is %d\" % (s, n)))\n\n# Enqueue the events, the first argument is always the event type.\n# The listeners are not triggered during enqueue.\nqueue.enqueue(3, \"Hello\", 38)\nqueue.enqueue(5, \"World\", 58)\n\n# Process the event queue, dispatch all queued events.\nqueue.process();\n```\n\n## Documentations\n\n* [Overview](doc/introduction.md)\n* [Tutorials of CallbackList](doc/tutorial_callbacklist.md)\n* [Tutorials of EventDispatcher](doc/tutorial_eventdispatcher.md)\n* [Tutorials of EventQueue](doc/tutorial_eventqueue.md)\n* [Class CallbackList](doc/callbacklist.md)\n* [Class EventDispatcher](doc/eventdispatcher.md)\n* [Class EventQueue](doc/eventqueue.md)\n* [Policies -- configure eventpy](doc/policies.md)\n* There are runnable tutorials in the unit tests.\n\n## Run the unit tests\n\nGo to the root folder of eventpy, run `python -m pytest`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwqking%2Feventpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwqking%2Feventpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwqking%2Feventpy/lists"}