{"id":19931034,"url":"https://github.com/dboslee/evently","last_synced_at":"2025-07-29T14:10:38.610Z","repository":{"id":46635703,"uuid":"293163113","full_name":"dboslee/evently","owner":"dboslee","description":"A super lightweight event bus for python","archived":false,"fork":false,"pushed_at":"2021-10-02T15:21:59.000Z","size":9,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-18T04:56:32.607Z","etag":null,"topics":["async","asyncio","eventbus","events","hacktoberfest","message-broker","message-bus","messaging","pubsub","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dboslee.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-09-05T22:21:37.000Z","updated_at":"2024-02-20T13:47:52.000Z","dependencies_parsed_at":"2022-08-29T15:10:55.772Z","dependency_job_id":null,"html_url":"https://github.com/dboslee/evently","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dboslee%2Fevently","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dboslee%2Fevently/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dboslee%2Fevently/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dboslee%2Fevently/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dboslee","download_url":"https://codeload.github.com/dboslee/evently/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252179052,"owners_count":21707107,"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":["async","asyncio","eventbus","events","hacktoberfest","message-broker","message-bus","messaging","pubsub","python"],"created_at":"2024-11-12T23:05:53.129Z","updated_at":"2025-05-03T10:32:19.585Z","avatar_url":"https://github.com/dboslee.png","language":"Python","readme":"# Evently [![Build Status](https://travis-ci.com/dboslee/evently.svg?branch=master)](https://travis-ci.com/dboslee/evently)\n\nA lightweight event bus for python asyncio\n\n**About Evently**:\n- Written in python3.8\n- Built around asynio\n- Uses type hinting\n- Simple API\n- Threadsafe \n\n### How to install\n`pip install evently`\n\n### Dev environment setup\n```\n# Clone the repository.\ngit clone https://github.com/dboslee/evently\ncd evently\n\n# Setup virtualenv\npip3 install virtualenv\npython3 -m virtualenv env\nsource env/bin/activate\n\n# Run tests.\npython -m unittest discover -p test_*.py\n```\n\n### Code Examples\nHere is a complete example\n```\nimport asyncio\nfrom evently import Evently, Event\n\nloop = asyncio.get_event_loop()\nevently = Evently(loop)\n\n\n@evently.subscribe(\"hello\")\nasync def say_world(event: Event):\n    print(\"world\")\n\n\nasync def main():\n    evently.publish(\"hello\")\n    await asyncio.sleep(0)\n\n\nloop.run_until_complete(main())\n```\n\nPass data along with an event and access it with `event.event_data`\n```\n@evently.subscribe(\"hello\")\ndef say_world(event):\n    print(event.event_type)\n    print(event.event_data)\n    print(\"world\")\n\nevently.publish(\"hello\", {\"example\": \"data\"})\n```\n\nSubscribe to the same event many times\n```\n@evently.subscribe(\"hello\")\ndef say_world(event):\n    print(\"world\")\n\n@evently.subscribe(\"hello\")\ndef say_goodbye(event):\n    print(\"goodbye\")\n```\n\nSubscribe to multiple events\n```\n@evently.subscribe([\"hello\", \"hola\"])\ndef say_world(event):\n    if event.event_type == \"hello\":\n        print(\"world\")\n    elif event.event_type == \"hola\":\n        print(\"mundo\")\n```\n\nUnsubscribe when you no longer want a handler to be called\n```\n@evently.subscribe(\"hello\")\ndef say_world(event):\n    print(\"world\")\n\nsay_world.unsubscribe()\n```\n\nRun blocking code in an executor with the kwarg `blocking=True`\n```\nfrom time import sleep\n\n@evently.subscribe(\"hello\", blocking=True)\ndef say_world_blocking(event):\n    sleep(10)\n    print(\"world\")\n```\n\nReceive the EventHandler instance as a kwarg by using `context=True`\n```\nfrom time import sleep\n\n@evently.subscribe(\"hello\", context=True)\ndef say_world_blocking(event, context):\n    sleep(10)\n    print(\"world\")\n    context.unsubscribe()\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdboslee%2Fevently","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdboslee%2Fevently","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdboslee%2Fevently/lists"}