Skip to main content

Asynchronous named events with no dependencies

Project description

AsyncEv: asynchronous event objects

PyPI - Python Version

AsyncEv leverages asyncio to create events that can be subscribed to and waited for.

Installation

pip install asyncev

Usage

import asyncio
import asyncev
from dataclasses import dataclass

# Create an event
@dataclass
class MyEvent(asyncev.Event):
    value: str

# Create a handler
async def on_myevent(ev: MyEvent):
    print(f"Got a MyEvent with the value {ev.value}!")

asyncev.bind(MyEvent, on_myevent)

# Emit event (requires a running asyncio event loop)
async def main():
    asyncev.emit(MyEvent(value="hello world"))
    
asyncio.run(main())

Development

Recommended tooling is uv.

Building

$ uv build

Testing

$ uv run tox

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

asyncev-1.0a0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyncev-1.0a0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file asyncev-1.0a0.tar.gz.

File metadata

  • Download URL: asyncev-1.0a0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.18

File hashes

Hashes for asyncev-1.0a0.tar.gz
Algorithm Hash digest
SHA256 50ed63424559930cbaa91c2975329a6d01937e3a5787bfa5d6c0ab198b37108a
MD5 cf5eaf07749da26f86d540373f633a94
BLAKE2b-256 185e6027a9013941ca3d7fd346196ecd0528deaa7437088b1c579c280058c4ef

See more details on using hashes here.

File details

Details for the file asyncev-1.0a0-py3-none-any.whl.

File metadata

  • Download URL: asyncev-1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.18

File hashes

Hashes for asyncev-1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 283fbcd253449774d6d5e0168c63e0265613839155bfd052fe8dfb652647ffc4
MD5 73e851af0770d6005b2b39c384016e39
BLAKE2b-256 d1ff65f57b966db1af1f8ad3cfbb846dcde02a0cfd6a7e5eb75c6b31d276151f

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