{"id":7207,"library":"eventkit","title":"Event-driven Data Pipelines","description":"Eventkit is a Python library designed for creating event-driven data pipelines and enabling communication between loosely coupled components. It leverages Python's `asyncio` for seamless integration with asynchronous programming patterns. The library's interface is kept Pythonic, using familiar names and idioms. The current version is 1.0.3, with releases tied to development cycles rather than a fixed cadence, though updates appear infrequent based on PyPI history.","status":"active","version":"1.0.3","language":"en","source_language":"en","source_url":"https://github.com/erdewit/eventkit","tags":["event-driven","asyncio","data-pipelines","reactive-programming","streaming"],"install":[{"cmd":"pip install eventkit","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Requires Python 3.6 or higher.","package":"python","optional":false}],"imports":[{"note":"The recommended practice is to import `eventkit` with the alias `ev` and access classes like `Event` directly from `ev`.","symbol":"Event","correct":"import eventkit as ev\nevent = ev.Event()"},{"note":"The recommended practice is to import `eventkit` with the alias `ev` and access classes like `Sequence` directly from `ev`.","symbol":"Sequence","correct":"import eventkit as ev\npipeline = ev.Sequence(...)"}],"quickstart":{"code":"import eventkit as ev\n\ndef my_listener1(value):\n    print(f\"Listener 1 received: {value}\")\n\ndef my_listener2(value):\n    print(f\"Listener 2 processed: {value * 2}\")\n\n# Create an event\nmy_event = ev.Event()\n\n# Connect listeners to the event\nmy_event += my_listener1\nmy_event += my_listener2\n\n# Emit a value, triggering all connected listeners\nmy_event.emit(5)\nmy_event.emit(10)\n\n# You can also use method chaining for pipelines\npipeline_event = (\n    ev.Sequence([1, 2, 3])\n    .map(lambda x: x * 10)\n    .enumerate()\n)\n\n# Run a synchronous pipeline\nprint(\"Pipeline output:\", pipeline_event.run())","lang":"python","description":"This quickstart demonstrates the core functionality of `eventkit`: creating an event, connecting multiple listeners to it, and emitting values. It also shows a basic synchronous data pipeline using `Sequence`, `map`, and `enumerate` operators."},"warnings":[{"fix":"To resolve this in Jupyter, you can use the `nest_asyncio` library: `import nest_asyncio; nest_asyncio.apply()`. Alternatively, for awaiting single results in recent Jupyter versions, you can use the top-level `await` statement directly: `await event.list()`.","message":"When running `eventkit`'s asynchronous operations (e.g., `event.run()` for async pipelines, `ev.Timer().run()`) directly within a Jupyter notebook cell, you might encounter a `RuntimeError` if the asyncio event loop is already active.","severity":"gotcha","affected_versions":"All versions 1.x.x"},{"fix":"Always verify the project's GitHub URL (https://github.com/erdewit/eventkit) or PyPI page to confirm you have the correct library. The library for event-driven data pipelines focuses on `asyncio` and stream processing, not macOS-specific calendar integration.","message":"The package name 'eventkit' is shared by other, unrelated Python libraries (e.g., `pyobjc-framework-EventKit` for macOS calendar access, `outcome-eventkit` for CloudEvents). Ensure you are installing and using the correct library by `erdewit` for event-driven data pipelines.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Apply `nest_asyncio` at the start of your script or notebook: `import nest_asyncio; nest_asyncio.apply()`. Or, if awaiting a single result in Jupyter, use `await` directly on the callable (e.g., `await event.list()`).","cause":"Attempting to run an asyncio-based `eventkit` operation (e.g., `event.run()`, `ev.Timer().run()`) in an environment like a Jupyter notebook where an asyncio event loop is already active.","error":"RuntimeError: Cannot run the event loop while another loop is running"},{"fix":"The standard and recommended way to import is `import eventkit as ev`. Then access the `Event` class as `ev.Event()`. Other core classes like `Sequence`, `Range`, `Zip` are also accessed via `ev.Sequence()`, `ev.Range()`, `ev.Zip()`.","cause":"This error typically occurs if you import `eventkit` without an alias, or attempt to access submodules incorrectly.","error":"AttributeError: module 'eventkit' has no attribute 'Event'"}]}