aiosignal

raw JSON →
1.4.0 verified Tue May 12 auth: no python install: verified quickstart: verified

aiosignal is a Python library designed to manage asynchronous callbacks in asyncio projects. The current version is 1.4.0, released on July 3, 2025. The library has a moderate release cadence, with updates typically occurring annually.

pip install aiosignal
error ModuleNotFoundError: No module named 'aiosignal'
cause The 'aiosignal' package is not installed in the Python environment.
fix
pip install aiosignal
error ImportError: cannot import name 'Signal' from 'aiosignal'
cause The 'Signal' class is not found in the 'aiosignal' module, possibly due to an incorrect import statement or version mismatch.
fix
from aiosignal import Signal
error TypeError: 'Signal' object is not callable
cause Attempting to call a 'Signal' object as a function, which is not supported.
fix
Use 'await signal.send(data)' to trigger callbacks.
error AttributeError: 'Signal' object has no attribute 'append'
cause Trying to use list methods like 'append' on a 'Signal' object, which does not support them.
fix
Use 'signal.connect(callback)' to add callbacks.
error RuntimeError: Cannot modify frozen signal
cause Attempting to modify a 'Signal' object after it has been frozen.
fix
Ensure modifications are made before calling 'signal.freeze()'.
breaking Dropped support for Python 3.7 and 3.8.
fix Upgrade your Python environment to version 3.9 or newer.
gotcha Once a Signal is frozen, adding or removing callbacks is forbidden.
fix Ensure all necessary callbacks are added before calling freeze().
gotcha Callbacks must be asynchronous functions.
fix Define callbacks using async def.
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.03s 18.7M
3.10 slim (glibc) - - 0.02s 19M
3.11 alpine (musl) - - 0.07s 20.6M
3.11 slim (glibc) - - 0.05s 21M
3.12 alpine (musl) - - 0.05s 12.5M
3.12 slim (glibc) - - 0.06s 13M
3.13 alpine (musl) - - 0.01s 11.8M
3.13 slim (glibc) - - 0.01s 12M
3.9 alpine (musl) - - 0.03s 18.2M
3.9 slim (glibc) - - 0.02s 19M

This example demonstrates creating a Signal, registering a callback, freezing the signal, and sending data to the callback.

import asyncio
from aiosignal import Signal

async def callback(data):
    print(f'Received data: {data}')

async def main():
    signal = Signal(owner=None)
    signal.append(callback)
    signal.freeze()
    await signal.send('Hello, World!')

asyncio.run(main())