{"id":9439,"library":"aeventkit","title":"aeventkit: Event-Driven Data Pipelines","description":"aeventkit is an active Python library (current version 2.1.0) for building event-driven data pipelines. It leverages Pydantic v2 for robust data validation and AnyIO for asynchronous execution, making it suitable for modern, high-performance applications. The library focuses on clear separation of concerns with publishers, subscribers, and an event bus.","status":"active","version":"2.1.0","language":"en","source_language":"en","source_url":"https://github.com/ib-api-reloaded/eventkit","tags":["event-driven","async","data-pipelines","pydantic","anyio","event-bus"],"install":[{"cmd":"pip install aeventkit","lang":"bash","label":"Install aeventkit"}],"dependencies":[{"reason":"Data validation and event model definition (requires >=2.0.0)","package":"pydantic","optional":false},{"reason":"Asynchronous concurrency backend (requires >=4.0.0)","package":"anyio","optional":false},{"reason":"Logging (requires >=0.7.0)","package":"loguru","optional":false},{"reason":"Rich terminal output (requires >=13.0.0)","package":"rich","optional":false}],"imports":[{"symbol":"Event","correct":"from aeventkit import Event"},{"symbol":"EventPublisher","correct":"from aeventkit import EventPublisher"},{"symbol":"EventSubscriber","correct":"from aeventkit import EventSubscriber"},{"symbol":"EventBus","correct":"from aeventkit import EventBus"}],"quickstart":{"code":"import anyio\nfrom aeventkit import Event, EventBus, EventSubscriber, EventPublisher\nfrom pydantic import Field\n\nclass MyEvent(Event):\n    message: str = Field(..., description=\"A simple test message\")\n\nclass MySubscriber(EventSubscriber):\n    async def handle(self, event: MyEvent):\n        print(f\"Subscriber received: {event.message}\")\n\nasync def main():\n    bus = EventBus()\n    subscriber = MySubscriber()\n    publisher = EventPublisher()\n\n    bus.register_subscriber(subscriber)\n    bus.register_publisher(publisher)\n\n    print(\"Publishing event...\")\n    await publisher.publish(MyEvent(message=\"Hello, aeventkit!\"))\n    await anyio.sleep(0.1) # Give subscriber a moment to process\n    print(\"Event published and potentially handled.\")\n\nif __name__ == \"__main__\":\n    anyio.run(main)\n","lang":"python","description":"This example demonstrates how to define a custom Event, create a Publisher and Subscriber, register them with an EventBus, and publish an event. It uses `anyio.run()` to execute the asynchronous main function, which is the standard entry point for aeventkit applications."},"warnings":[{"fix":"Ensure your application's entry point uses `anyio.run()` or integrates within an existing `asyncio` or `anyio` event loop. All event handlers and interactions should be `async` functions.","message":"aeventkit is designed for asynchronous operations using AnyIO. All core components and interaction methods are `async`/`await` compatible. Attempting to call async methods from synchronous code without an event loop or proper execution context will result in errors.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Upgrade Pydantic to version 2 or higher (`pip install 'pydantic>=2.0.0' --upgrade`). Verify no other project dependencies are pinning Pydantic to v1.","message":"aeventkit strictly requires Pydantic v2 (>=2.0.0). Projects using Pydantic v1 will encounter `PydanticImportError` or validation issues due to API changes between Pydantic versions.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always call `bus.register_publisher(publisher_instance)` and `bus.register_subscriber(subscriber_instance)` after initializing your bus and components.","message":"Publishers and Subscribers must be registered with an `EventBus` instance to communicate. Creating an `EventPublisher` or `EventSubscriber` alone does not make them active participants in the event stream.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure `anyio.run()` is called only once at the root of your application. If integrating with an existing async application, directly `await` your main function rather than calling `anyio.run()`.","cause":"Attempting to call `anyio.run()` or `asyncio.run()` when an event loop is already active, for example, in a Jupyter notebook or if `anyio.run()` is called multiple times.","error":"RuntimeError: Event loop is already running"},{"fix":"Upgrade Pydantic: `pip install 'pydantic>=2.0.0' --upgrade`. If issues persist, check your environment for conflicting Pydantic versions from other dependencies.","cause":"The installed version of Pydantic is v1.x, or Pydantic v2 is not correctly installed/accessible.","error":"pydantic.v1_error.PydanticImportError: Pydantic V2 is not installed. aeventkit requires pydantic >= 2.0.0."},{"fix":"Before publishing, ensure you have called `bus.register_publisher(your_publisher_instance)` where `bus` is your `EventBus` instance.","cause":"An `EventPublisher` instance was created but not registered with an `EventBus` before attempting to publish an event.","error":"AttributeError: 'NoneType' object has no attribute 'publish'"}]}