zope.event
A minimal synchronous event publishing and dispatch system for Python.
Repository Health
Technical Analysis
zope.event provides a tiny, dependency-free event system for Python. It offers an event-publishing API for applications that want to emit events without knowing who is listening, and a very simple synchronous dispatch mechanism that calls a global list of subscriber functions in order.
Deliberately minimal, zope.event is designed as a foundation on which richer event-dispatching systems are built. The type-based dispatching in zope.component, for example, layers on top of it. Despite its small size it is one of the most-downloaded packages on PyPI, pulled in transitively across the Zope and Python ecosystems.
What You Get
- A global
subscriberslist of callables that receive published events - A
notify(event)function that dispatches an event to all subscribers in order - A
classhandlerhelper for class-based subscriber registration - Zero runtime dependencies and a fully synchronous execution model
- A stable foundation reused by zope.component and other dispatchers
Common Use Cases
- Emitting application events without coupling to specific subscribers
- Serving as the low-level dispatch primitive under zope.component
- Building a custom, more sophisticated event-dispatch system on top
- Adding simple in-process hooks or lifecycle notifications to a library
Under The Hood
Architecture — The package is intentionally minimal: a module-level subscribers list holds callables, and notify(event) iterates that list, calling each subscriber with the event object synchronously and in registration order. There is no type matching or filtering here — that responsibility is pushed up to consumers such as zope.component, which registers a handler in subscribers and implements its own type-based dispatch on top.
Tech Stack — Pure Python with no runtime dependencies, supporting a wide range of CPython (and PyPy) versions. It is packaged with the standard Zope toolchain, tested via GitHub Actions, and documented on Read the Docs.
Code Quality — A mature, long-lived Zope Foundation project (200+ commits, 30 contributors) with continuous integration and Sphinx documentation. The code surface is small enough to audit at a glance, and its ~7.5M weekly downloads reflect deep transitive use across the ecosystem.
API Design — The API is about as small as an event system can be: import notify, append a callable to subscribers, done. This simplicity is the point — it makes zope.event trivial to learn and a clean substrate for building more capable dispatchers without imposing any policy of its own.