--- id: events version: "0.5" license: BSD license_treatment: permissive maintenance: abandoned --- # Events — Bringing the elegance of C# EventHandler to Python License: permissive · Maintenance: abandoned · Popularity: top 1,000 on PyPI ## Install pip install events uv add events poetry add events ## Description Events ------ The C# language provides a handy way to declare, subscribe to and fire events. Technically, an event is a "slot" where callback functions (event handlers) can be attached to - a process referred to as subscribing to an event. Here is a handy package that encapsulates the core to event subscription and event firing and feels like a "natural" part of the language. :: >>> def something_changed(reason): ... print "something changed because %s" % reason >>> from events import Events >>> events = Events() >>> events.on_change += something_changed Multiple callback functions can subscribe to the same event. When the event is fired, all attached event handlers are invoked in sequence. To fire the event, perform a call on the slot: :: >>> events.on_change('it had to happen') 'something changed because it had to happen' By default, Events does not check if an event can be subscribed to and fired. You can predefine events by subclassing Events and listing them. Attempts to subscribe to or fire an undefined event will raise an EventsException. :: >>> class MyEvents(Events): ... __events__ = ('on_this', 'on_that', )... ## AI interpretation — verify before relying Events provides a publish-subscribe pattern for Python, letting you attach callback functions to named events and fire them to notify all subscribers—similar to C# event handlers. Verdict: Events is a lightweight, dependency-free event dispatcher suitable for simple pub-sub patterns, but its abandoned status and Beta development classification mean it carries maintenance risk. No known vulnerabilities exist, and the permissive BSD license poses no legal barrier. [View on SkillFed](https://skillfed.io/packages/events) · [View on PyPI](https://pypi.org/project/events/)