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.1.tar.gz (6.8 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.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: signalkit-2.0.1.tar.gz
  • Upload date:
  • Size: 6.8 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.1.tar.gz
Algorithm Hash digest
SHA256 2e6fb53649fddda4901423de562646cf730a3ac4091b06e5dcd128ee1c0cb9c7
MD5 d5af10527653dcedac0704ae0986197c
BLAKE2b-256 6b6a16287a59f34c990de9b9a1ce57340f77ab72b544f6ad9a6a4f5943362d03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: signalkit-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e007f85d9d27d0ba2384d5014ab989386d78c59003d53769b399a712eea39540
MD5 7d79ae4ebffa19142915228cff8c19e4
BLAKE2b-256 0ef40c473027b595f11e30b5ec9eec9e215f92192487351f95b1c812dc469612

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