Skip to main content

Gev (General Events Manager)

$ pip install gev

Usage

from gev import Event, EventManager

manager = EventManager()

def handler_1(e):
    print("handler_1 called with", e)

def handler_2(e):
    print("handler_2 called with", e)

# Register event handlers
manager.on('sys_1::event_a').do(handler_1)
manager.on('sys_1::event_b').do(handler_2)

manager.take(Event(
    source='sys_1',
    type='event_a',
    payload={'a': 1}
))  # handler_1 will be called

manager.take(Event(
    source='sys_1',
    type='event_b',
    payload={'b': 1}
))  # handler_1 will be called

If you don't want to initialize an EventManager instance, you can use the global default_manager and its on and take methods exposed at module level.

from gev import on, take, Event

def handler_1(e):
    print("handler_1 called with", e)

on('sys_1::event_a').do(handler_1)

take(Event(
    source='sys_1',
    type='event_a',
    payload={'a': 1}
))  # handler_1 will be called

Metadata

Release files for gev 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gev 0.1.2
File Size Uploaded
gev-0.1.2.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gev 0.1.2
File Interpreter ABI Platform
gev-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / gev-0.1.2.tar.gz

Download URL gev-0.1.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bf4da5d8fc713c130970283a6e2a4aa2db2538b50a674bfd56279a33b1647d2c
BLAKE2b-256 checksum
How to use checksums
ee043b4e21c40647717e4f0aa012606f63adfd4fe6cb75452f1515d8d1184943
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.8.14 Linux/5.15.0-1023-azure

Release files / gev-0.1.2-py3-none-any.whl

Download URL gev-0.1.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99f92f879fc749201347f7c8cfd9f47227731388d6986ba2831659ce95a42a12
BLAKE2b-256 checksum
How to use checksums
c835d7e2c68f11b71f507d6db4ecdab80afa93c2b2c4148921ed56ca36c209ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.8.14 Linux/5.15.0-1023-azure

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page