Metadata-Version: 2.1
Name: gev
Version: 0.0.2
Summary: General Events Manager
Home-page: https://github.com/wonderbeyond/gev
License: MIT
Keywords: python,events
Author: Wonder
Author-email: wonderbeyond@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: testing
Requires-Dist: pytest (>=7.1.2,<8.0.0); extra == "testing"
Requires-Dist: tox (>=3.25.0,<4.0.0); extra == "testing"
Project-URL: Documentation, https://github.com/wonderbeyond/gev
Project-URL: Repository, https://github.com/wonderbeyond/gev
Description-Content-Type: text/markdown

# Gev (General Events Manager)

```shell
$ pip install gev
```

---

## Usage

```python
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.

```python
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
```

