Name | asyncev JSON |
Version |
1.0.2
JSON |
| download |
home_page | None |
Summary | Asynchronous named events with no dependencies |
upload_time | 2025-07-20 21:25:35 |
maintainer | None |
docs_url | None |
author | Emil Tylén |
requires_python | >=3.9 |
license | None |
keywords |
async
asyncio
event
library
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
AsyncEv: asynchronous event objects
===================================

AsyncEv leverages `asyncio` to create events that can be subscribed to and waited for.
## Installation
pip install asyncev
## Usage
```python
import asyncio
import asyncev
from dataclasses import dataclass
# Create an event
@dataclass
class MyEvent(asyncev.Event):
value: str
# Create a listener
async def on_myevent(ev: MyEvent):
print(f"Got a MyEvent with the value {ev.value}!")
# also works for methods, with binds possible at init time.
class Listener:
def __init__(self, name: str):
self.name = name
asyncev.bind(MyEvent, self.on_myevent)
async def on_myevent(self, ev: MyEvent):
print(f"{self.name} got a MyEvent with the value {ev.value}!")
asyncev.bind(MyEvent, on_myevent)
# Emit event (requires a running asyncio event loop)
async def main():
jeff = Listener("Jeff")
asyncev.emit(MyEvent(value="hello"))
await asyncio.sleep(.1)
del jeff # cleanup of event listeners is automatic
asyncev.emit(MyEvent("goodbye"))
await asyncio.sleep(.1)
asyncio.run(main())
```
## Development
Recommended tooling is [`uv`](https://astral.sh/uv). install it with `pip`.
### Building
$ uv build
### Testing
$ uv run tox
Raw data
{
"_id": null,
"home_page": null,
"name": "asyncev",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "async, asyncio, event, library",
"author": "Emil Tyl\u00e9n",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/be/5d/0cda8079dd83203587176733a8528acab529f335b16ee20caade78e6613b/asyncev-1.0.2.tar.gz",
"platform": null,
"description": "AsyncEv: asynchronous event objects\n===================================\n\n\n\n\nAsyncEv leverages `asyncio` to create events that can be subscribed to and waited for.\n\n## Installation\n\n pip install asyncev\n\n## Usage\n\n```python\nimport asyncio\nimport asyncev\nfrom dataclasses import dataclass\n\n# Create an event\n@dataclass\nclass MyEvent(asyncev.Event):\n value: str\n\n# Create a listener\nasync def on_myevent(ev: MyEvent):\n print(f\"Got a MyEvent with the value {ev.value}!\")\n\n# also works for methods, with binds possible at init time.\nclass Listener:\n def __init__(self, name: str):\n self.name = name\n asyncev.bind(MyEvent, self.on_myevent)\n async def on_myevent(self, ev: MyEvent):\n print(f\"{self.name} got a MyEvent with the value {ev.value}!\")\n\nasyncev.bind(MyEvent, on_myevent)\n\n\n# Emit event (requires a running asyncio event loop)\nasync def main():\n jeff = Listener(\"Jeff\")\n asyncev.emit(MyEvent(value=\"hello\"))\n await asyncio.sleep(.1)\n\n del jeff # cleanup of event listeners is automatic\n asyncev.emit(MyEvent(\"goodbye\"))\n await asyncio.sleep(.1)\n \nasyncio.run(main())\n```\n\n## Development\n\nRecommended tooling is [`uv`](https://astral.sh/uv). install it with `pip`.\n\n### Building\n\n $ uv build\n\n### Testing\n\n $ uv run tox\n",
"bugtrack_url": null,
"license": null,
"summary": "Asynchronous named events with no dependencies",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/acetylen/asyncev",
"Issues": "https://github.com/acetylen/asyncev/issues"
},
"split_keywords": [
"async",
" asyncio",
" event",
" library"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e35e15992a341ebebd97bfb33507158a75a2414333f69c3af60ed57352a8ea24",
"md5": "b850a9743fb98e888f190d08e039d1b8",
"sha256": "8c5829327b024c154af9443cdfb0dd2f6eeabb105754be43250b5b719eb442b6"
},
"downloads": -1,
"filename": "asyncev-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b850a9743fb98e888f190d08e039d1b8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 4988,
"upload_time": "2025-07-20T21:25:34",
"upload_time_iso_8601": "2025-07-20T21:25:34.567297Z",
"url": "https://files.pythonhosted.org/packages/e3/5e/15992a341ebebd97bfb33507158a75a2414333f69c3af60ed57352a8ea24/asyncev-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "be5d0cda8079dd83203587176733a8528acab529f335b16ee20caade78e6613b",
"md5": "a0075a0fa34dbb03370349ad5b395cf9",
"sha256": "5f866f56f3b22e4739df06dd50d0f46ed94d61924a0668841b0b4481ce1f1392"
},
"downloads": -1,
"filename": "asyncev-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "a0075a0fa34dbb03370349ad5b395cf9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 18623,
"upload_time": "2025-07-20T21:25:35",
"upload_time_iso_8601": "2025-07-20T21:25:35.827012Z",
"url": "https://files.pythonhosted.org/packages/be/5d/0cda8079dd83203587176733a8528acab529f335b16ee20caade78e6613b/asyncev-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-20 21:25:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "acetylen",
"github_project": "asyncev",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "asyncev"
}