Skip to main content

aio_pydispatch

GitHub Workflow Status (branch) GitHub PyPI codecov Codacy Badge

Asyncio pydispatch (Signal Manager)

This is based on pyDispatcher reference Django Signals and reference scrapy SignalManager implementation on Asyncio

Event or Signal (not python bif signal)

You can bind multiple listeners (called sender) to listening multiple handlers (called receiver) on one event (called signal).

Default, the listener is None, so when the event is fire with no listener, all handlers will be executed that was bind default listener.

Usage

Most of the program has start and stop events, we can register some handler to events, we can also specify a sender.

import asyncio

from aio_pydispatch import Signal

server_start = Signal()
server_stop = Signal()


def ppp(value: str, **kwargs) -> None:
    print(value, kwargs)


async def main():
    server_start.connect(ppp, sender='loading config')
    server_stop.connect(ppp)
    await server_start.send(sender='loading config', value='foo')
    await asyncio.sleep(1)
    await server_stop.send(value='foo')


if __name__ == '__main__':
    asyncio.run(main())

Similar design

sync:

async:

Others

Event system in Python

Metadata

Release files for aio-pydispatch 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aio-pydispatch 1.0.0
File Size Uploaded Provenance Actions
aio_pydispatch-1.0.0.tar.gz 5.8 kB Without provenance Details for aio_pydispatch-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aio-pydispatch 1.0.0
File Interpreter ABI Platform Actions
aio_pydispatch-1.0.0-py3-none-any.whl Python 3 none any Details for aio_pydispatch-1.0.0-py3-none-any.whl

Total release size: 12.2 kB

Release files / aio_pydispatch-1.0.0.tar.gz

Download URL aio_pydispatch-1.0.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e17a8654a106110f794e1d0b3e933f69458c9a21b8e937f4d7fa7bb77d6ee4e4
BLAKE2b-256 checksum
How to use checksums
b635f5e38c30d6ada7baee214b851c4c347b619b0ddfc31ed88a4393a24d7b5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / aio_pydispatch-1.0.0-py3-none-any.whl

Download URL aio_pydispatch-1.0.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
771a7cedf976a869e6bede9bfa3655e64e86848abc810f5c353e9cfd83e03e9b
BLAKE2b-256 checksum
How to use checksums
5a54a36932a6f1b404dba43d74ab9694e17fb24b91cecf2927f1d57dab4f9417
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Security for aio-pydispatch 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page