---
title: "aeventkit | pypx"
description: "Event-driven data pipelines"
canonical_url: "https://pypx.app/packages/aeventkit"
meta:
  "og:description": "Event-driven data pipelines"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_aeventkit%2Cversion_3.0.1%2Csummary_Event-driven%2Bdata%2Bpipelines%2Clicense_BSD-3-Clause%2Cp_Ii9wYWNrYWdlcy9hZXZlbnRraXQi%2Cs_ZkuDWXh_m-Mjd7Uq.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "aeventkit 3.0.1"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_aeventkit%2Cversion_3.0.1%2Csummary_Event-driven%2Bdata%2Bpipelines%2Clicense_BSD-3-Clause%2Cp_Ii9wYWNrYWdlcy9hZXZlbnRraXQi%2Cs_ZkuDWXh_m-Mjd7Uq.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **aeventkit**

v3.0.1

Event-driven data pipelines

36 KB Python 3.11+ py3-none-anyBSD-3-Clause

[**Diff **](https://pypx.app/packages/aeventkit/diff)

`$ uv add aeventkit`

[![Build](https://github.com/ib-api-reloaded/eventkit/actions/workflows/build-n-test.yml/badge.svg)](https://github.com/ib-api-reloaded/eventkit/actions) [![PyPi](https://img.shields.io/pypi/v/aeventkit.svg)](https://pypi.org/project/aeventkit/) [![Documentation](https://readthedocs.org/projects/eventkit/badge/?version=latest)](https://eventkit.readthedocs.io)

## Introduction

The primary use cases of eventkit are

- to send events between loosely coupled components;
- to compose all kinds of event-driven data pipelines.

The interface is kept as Pythonic as possible, with familiar names from Python and its libraries where possible. For scheduling asyncio is used and there is seamless integration with it.

See the examples and the [introduction notebook](https://github.com/ib-api-reloaded/eventkit/tree/main/notebooks/eventkit_introduction.ipynb) to get a true feel for the possibilities.

Note: the package is published as aeventkit and imported as eventkit.

## Installation

```
pip install aeventkit

pip install aeventkit[numpy]  # with the Array operators
```

Python\_ 3.11 or later is required (tested on CPython 3.11 to 3.15 and PyPy 3.11).

Upgrading from 2.x? See [Upgrading to 3.0](https://eventkit.readthedocs.io/en/latest/upgrading.html) and the [changelog](https://eventkit.readthedocs.io/en/latest/changelog.html).

## Examples

**Create an event and connect two listeners**

```python
import eventkit as ev

def f(a, b):
    print(a * b)

def g(a, b):
    print(a / b)

event = ev.Event()
event += f
event += g
event.emit(10, 5)
```

**Create a simple pipeline**

```python
import eventkit as ev

event = (
    ev.Sequence('abcde')
    .map(str.upper)
    .enumerate()
)

print(event.run())  # in Jupyter: await event.list()
```

Output:

```
[(0, 'A'), (1, 'B'), (2, 'C'), (3, 'D'), (4, 'E')]
```

**Create a pipeline to get a running average and standard deviation**

(with the numpy extra: pip install aeventkit\[numpy])

```python
import random
import eventkit as ev

source = ev.Range(1000).map(lambda i: random.gauss(0, 1))

event = source.array(500)[ev.ArrayMean, ev.ArrayStd].zip()

print(event.last().run())  # in Jupyter: await event.last()
```

Output:

```
[(0.00790957852672618, 1.0345673260655333)]
```

**Combine async iterators together**

```python
import asyncio
import eventkit as ev

async def ait(r):
    for i in r:
        await asyncio.sleep(0.1)
        yield i

async def main():
    async for t in ev.Zip(ait('XYZ'), ait('123')):
        print(t)

asyncio.run(main())  # in Jupyter: await main()
```

Output:

```
('X', '1')
('Y', '2')
('Z', '3')
```

**Real-time video analysis pipeline**

```python
self.video = VideoStream(conf.CAM_ID)
scene = self.video | FaceTracker | SceneAnalyzer
lastScene = scene.aiter(skip_to_last=True)
async for frame, persons in lastScene:
    ...
```

[Full source code](https://github.com/erdewit/heartwave/blob/100e1a89d18756e141f9dcfbb73c55a1009debf4/heartwave/app.py#L88)

## Parallel processing

poolmap runs a function on the values of an event in a concurrent.futures executor: a process pool for CPU-bound work on all cores, an interpreter pool (Python 3.14+), or a thread pool for blocking I/O. Results stay in order unless ordered=False, and chunksize batches small tasks:

```python
import bz2
from concurrent.futures import ProcessPoolExecutor

import eventkit as ev

if __name__ == "__main__":
    data = [b"A" * 1_000_000] * 1000
    with ProcessPoolExecutor() as pool:
        sizes = ev.Sequence(data).poolmap(pool, bz2.compress, chunksize=10).map(len)
        print(sizes.mean().last().run())
```

## Inspired by:

- [Qt Signals & Slots](https://doc.qt.io/qt-5/signalsandslots.html)
- [itertools](https://docs.python.org/3/library/itertools.html)
- [aiostream](https://github.com/vxgmichel/aiostream)
- [Bacon](https://baconjs.github.io/index.html)
- [aioreactive](https://github.com/dbrattli/aioreactive)
- [Reactive extensions](http://reactivex.io/documentation/operators.html)
- [underscore.js](https://underscorejs.org)
- [.NET Events](https://docs.microsoft.com/en-us/dotnet/standard/events)

## Documentation

The complete [API documentation](https://eventkit.readthedocs.io/en/latest/api.html).

## **Details **

<dl>

<dt>Version</dt>
<dd>3.0.1</dd>

<dt>License</dt>
<dd>BSD-3-Clause</dd>

<dt>Python</dt>
<dd>&gt;=3.11</dd>

<dt>Maintainer</dt>
<dd>Ewald R. de Wit</dd></dl>

## **Links**

- [Bug Tracker](https://github.com/ib-api-reloaded/eventkit/issues)
- [Homepage](https://github.com/ib-api-reloaded/eventkit)
- [Repository](https://github.com/ib-api-reloaded/eventkit)
- [View on PyPI](https://pypi.org/project/aeventkit/)

## **Release Cadence **

**2**

releases in the past year

avg 242 days between releases

## **Maintainers **

- Ewald R. de Wit

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/aeventkit#webpage","@type":"WebPage","description":"Event-driven data pipelines","name":"aeventkit","url":"https://pypx.app/packages/aeventkit","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/aeventkit"]}]},{"@id":"https://pypx.app/packages/aeventkit#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Event-driven data pipelines","license":"BSD-3-Clause","name":"aeventkit","softwareVersion":"3.0.1"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
