funksignal is a signaling library for event-driven programming
Project description
funksignal · 
funksignal is a synchronous signaling library for event-driven programming. Bind methods to signals which will be executed once the signal is emitted.
How to Install
To install funksignal, open a terminal and use the pip package manager:
pip install funksignal
Instructions
To use funksignal effectively, bind one or more methods to a signal identified by a unique key. When the signal is emitted, all methods bound to that signal will be executed. If you no longer need the binding, you can simply unbind it.
from funksignal import Signal
def example():
print("Hello World")
Signal.bind("signal-key", example)
Signal.emit("signal-key")
Signal.unbind("signal-key", example)
funksignal provides an interface to pass arguments – from within bind(), emit() or simultaniously via *args and **kwargs.
from funksignal import Signal
def example(a, b):
print(f"{a} {b}")
Signal.bind("1a", example)
Signal.emit("1a", "Hello", "World")
Signal.bind("1b", example, "Hello", "World")
Signal.emit("1b")
Signal.bind("2a", example)
Signal.emit("2a", a="Hello", b="World")
Signal.bind("2b", example, a="Hello", b="World")
Signal.emit("2b")
Signal.bind("2c", example, a="Hello")
Signal.emit("2c", b="World")
Documentation
Auto-generated documentation using pydoc-markdown.
bind
@classmethod
def bind(cls, key: Union[str, int], callable: callable, *args: any, **kwargs: any) -> None
Binds a callable to a signal. The callable will be executed when the signal is emitted.
unbind
@classmethod
def unbind(cls, key: Union[str, int], callable: callable) -> None
Unbinds a callable from a signal. After unbinding, the callable will no longer be executed when the signal is emitted.
emit
@classmethod
def emit(cls, key: Union[str, int], *args: any, **kwargs: any) -> None
Emits a signal identified by the given key. This triggers the execution of all callables that are bound to the signal. You can pass arguments to the bound methods via *args and **kwargs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file funksignal-0.1.0.tar.gz.
File metadata
- Download URL: funksignal-0.1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6ca0eee3dc635a768e5753841ab0ed345d412ec929e27382c168956d62cca62
|
|
| MD5 |
39f13f1bf3bb2291debca0fdec51b4e6
|
|
| BLAKE2b-256 |
8931f35bc704ef343a33be7c2cba76a96090d9227d81f09921a1e68535cd4f54
|
Provenance
The following attestation bundles were made for funksignal-0.1.0.tar.gz:
Publisher:
publish.yml on Dreamfarer/funksignal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
funksignal-0.1.0.tar.gz -
Subject digest:
c6ca0eee3dc635a768e5753841ab0ed345d412ec929e27382c168956d62cca62 - Sigstore transparency entry: 164901969
- Sigstore integration time:
-
Permalink:
Dreamfarer/funksignal@5668f13bca4387e32f58dec2cde242d770969ffb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Dreamfarer
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5668f13bca4387e32f58dec2cde242d770969ffb -
Trigger Event:
push
-
Statement type:
File details
Details for the file funksignal-0.1.0-py3-none-any.whl.
File metadata
- Download URL: funksignal-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a63bfc82c32f036e44a35ad47d71fdfc15ae8c7494f9fd0b0bd9d7746d40ff61
|
|
| MD5 |
fdbb4aab89e9a7ba5dcef4d595f7eb45
|
|
| BLAKE2b-256 |
ee71bbd17a51f01b1064f107451b0983560ae3501a72aacea2ae0fa2595ebbf9
|
Provenance
The following attestation bundles were made for funksignal-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Dreamfarer/funksignal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
funksignal-0.1.0-py3-none-any.whl -
Subject digest:
a63bfc82c32f036e44a35ad47d71fdfc15ae8c7494f9fd0b0bd9d7746d40ff61 - Sigstore transparency entry: 164901972
- Sigstore integration time:
-
Permalink:
Dreamfarer/funksignal@5668f13bca4387e32f58dec2cde242d770969ffb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Dreamfarer
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5668f13bca4387e32f58dec2cde242d770969ffb -
Trigger Event:
push
-
Statement type: