PyVents
PyVents is a powerful Python library for events.
Features
Installation
Using pip:
pip install pyvents
Using Poetry:
poetry add pyvents
Getting-Started
See examples for more.
Simple
from pyvents import Event
event = Event("myevent")
def subscriber():
print("Called subscriber")
def main():
event.subscribe(subscriber)
event.publish()
# Called subscriber
if __name__ == '__main__':
main()
Advanced
import threading
import asyncio
from pyvents import (
AsyncEvent,
Event,
EventChannel,
ThreadedEvent,
)
class MyEventChannel(EventChannel):
event = Event()
async_event = AsyncEvent()
threaded_event = ThreadedEvent()
@MyEventChannel.event.subscribe
def subscriber():
print("Called subscriber")
@MyEventChannel.async_event.subscribe
async def async_subscriber():
print("Called async_subscriber")
@MyEventChannel.threaded_event.subscribe
def threaded_subscriber():
print("Called threaded_subscriber")
print(f"Current thread: {threading.current_thread()}")
async def main():
MyEventChannel.event.publish()
# Called subscriber
await MyEventChannel.async_event.publish_async()
# Called async_subscriber
MyEventChannel.threaded_event.publish_threaded()
# Called threaded_subscriber
# Current thread: <Thread(Thread-1 (threaded_subscriber), started xxxx)>
if __name__ == "__main__":
asyncio.run(main())
Status
0.0.1 - RELEASED
License
PyVents is released under the MIT License. See the bundled LICENSE file for details.
Metadata
Release files for pyvents 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyvents-0.0.1.tar.gz | 4.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyvents-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / pyvents-0.0.1.tar.gz
| Download URL | pyvents-0.0.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cc66b3d5dfa5b18e0701048c5708edbfc0753cd56debe63e69df6f31685865a
|
|
BLAKE2b-256 checksum How to use checksums |
b67612e1658214c3be19ffe3129a33fbd543c1bea1092e393d60fa7e032befa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.1 Windows/10
|
Release files / pyvents-0.0.1-py3-none-any.whl
| Download URL | pyvents-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26972bfce7a4967342e1ba09abcd6f739d0200e29fe15e2291ec58762ed02afc
|
|
BLAKE2b-256 checksum How to use checksums |
8b7726571720eea2138de9e412ccd6a4948e6f002dc8dc8aa877c82156e49967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.1 Windows/10
|
Security for pyvents 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.