Library for event emitting and handling
Project description
wsignals
v0.2.3
Library for event emitting and handling
Installation
PyPI
pip install wsignals
GitHub
pip install git+https://github.com/wumtdev/wsignals.git
Manual
Clone from github
# using https
git clone https://github.com/wumtdev/wsignals.git
# using ssh
git clone git@github.com:wumtdev/wsignals.git
In the environment where you need to install library, install it as a local package. Specify path to cloned repository.
pip install /path/to/cloned_repo
Usage
Simple
from wsignals import Signal
on_start = Signal()
@on_start
def log_start():
print('started')
on_start.call()
Class + Async
import asyncio
from wsignals import Signal
class Dog:
def __init__(self, name: str):
self.on_bark = Signal()
self.name = name
def bark(self, msg: str):
print('bark!')
self.on_bark.call(msg)
async def main():
gamma = Dog('Gamma')
@gamma.on_bark
async def handle_gamma_bark(msg):
print(f'Gamma barked: {msg}')
gamma.bark()
asyncio.run(main())
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
wsignals-0.2.3.tar.gz
(16.7 kB
view details)
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 wsignals-0.2.3.tar.gz.
File metadata
- Download URL: wsignals-0.2.3.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f80b3315677d0b0b1bddb74044447d0bfecb7450eca98c0b3b325ca562df89e
|
|
| MD5 |
73f8892d59401d0a448f11ceb27368a6
|
|
| BLAKE2b-256 |
fd71cfc8ac2509ab2d284ed9ddb2f90efb98689d1878850ad7a1cef65aa33724
|
File details
Details for the file wsignals-0.2.3-py3-none-any.whl.
File metadata
- Download URL: wsignals-0.2.3-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e27a1ecf9f8be5bd3c30acc54c6a8a70bd38c94b0c00f0fbd81eab56eb7bed9
|
|
| MD5 |
0a733ea0339312262922406b9a5e7348
|
|
| BLAKE2b-256 |
e51d3c199df899e6fbd673e71e359d8744ecba1ee071be3c4c3c86cd4956a70e
|