Skip to main content

Structured, UUID-based signal orchestration utilities for Python using Blinker

Project description

SignalKit

SignalKit is a lightweight Python signaling library built upon the robust Blinker library. It provides a simple yet flexible way to dispatch signals and handle responses, automatically adapting to your handler function signatures.

Installation

pip install signalkit

Usage Example

# define event model
class Event:
    def __init__(self, text: str):
        self.text = text

# define handler
def handle_event(sender, event: Event) -> str:
    return event.text.upper()

# use CoolSignal
from signalkit import CoolSignal

signal = CoolSignal()
signal.connect(handle_event)

event = Event("hello world")
response = signal.send(sender=None, event=event)
print(response) # 'HELLO WORLD'
import asyncio
from signalkit import CoolSignalAsync

async def handle_event_async(sender, event: Event) -> str:
    return event.text.upper()

signal = CoolSignalAsync()
signal.connect(handle_event_async)

event = Event("hello async")
async def main():
    response = await signal.send(sender=None, event=event)
    print(response) # 'HELLO ASYNC'

asyncio.run(main())

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

signalkit-2.0.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

signalkit-2.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file signalkit-2.0.0.tar.gz.

File metadata

  • Download URL: signalkit-2.0.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for signalkit-2.0.0.tar.gz
Algorithm Hash digest
SHA256 8ad8e33a5c6a4c984bc4ecca6675cbd4e0c2eda92a8346ceb9be0c4ed1f7cac3
MD5 95fe164683da6191679136cc1b74e39d
BLAKE2b-256 bb545ae08aaaffdd06331fd88cf2de910bfc3db747f094d9b4186fbc78b7c2e2

See more details on using hashes here.

File details

Details for the file signalkit-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: signalkit-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for signalkit-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 def5b2e8489f2a450d99ff00ee7b90ef7ffcba264ea47a26323c3f3fb9f67b51
MD5 f976a1d7d014896a04a9518068ae444f
BLAKE2b-256 92c66fcaff6a8d45b56d840df4fc7936dcb0d6535ddf967cdc2440aef3ec368f

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