Skip to main content

Build PyPi Documentation

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 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 and the changelog.

Examples

Create an event and connect two listeners

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

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])

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

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

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

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:

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:

Documentation

The complete API documentation.

Metadata

Release files for aeventkit 3.0.1

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

Source distribution (sdist)

Source distribution for aeventkit 3.0.1
File Size Uploaded Provenance
aeventkit-3.0.1.tar.gz 33.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 71.0 kB

Release files / aeventkit-3.0.1.tar.gz

Download URL aeventkit-3.0.1.tar.gz
Size 33.9 kB
Tags Source
SHA-256 checksum
How to use checksums
906f850e18f3f88bb9eb02d1c9296a791ee02fa0db1a3c8568a086289f26145a
BLAKE2b-256 checksum
How to use checksums
2cefd7243c7634fcd40f8c080d4c606cfd4366b63cfeecb525d2551f16dd5295
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / aeventkit-3.0.1-py3-none-any.whl

Download URL aeventkit-3.0.1-py3-none-any.whl
Size 37.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b167b04317b80e4e9163445da44e843114adc74695aef32c515abd75a159efab
BLAKE2b-256 checksum
How to use checksums
41d587ccf8fdbac60797b089f1442efc18f0a660ac6cebeaacf1b0307dac115f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for aeventkit 3.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.

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