{"id":13468753,"url":"https://github.com/pyeve/events","last_synced_at":"2025-04-08T01:36:57.292Z","repository":{"id":7345492,"uuid":"8669069","full_name":"pyeve/events","owner":"pyeve","description":"Python Event Handling the C# Style","archived":false,"fork":false,"pushed_at":"2023-08-07T21:22:54.000Z","size":64,"stargazers_count":327,"open_issues_count":10,"forks_count":31,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-01T00:35:46.545Z","etag":null,"topics":["events","python"],"latest_commit_sha":null,"homepage":"https://events.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyeve.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-03-09T11:46:04.000Z","updated_at":"2024-12-05T14:35:08.000Z","dependencies_parsed_at":"2024-06-18T15:23:03.383Z","dependency_job_id":"5554b9d5-fbea-4e1d-a342-4a0c2fe170a9","html_url":"https://github.com/pyeve/events","commit_stats":{"total_commits":102,"total_committers":10,"mean_commits":10.2,"dds":"0.18627450980392157","last_synced_commit":"e8ec95bed91aa6f86d39a72cbcfb16a9dce819a4"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyeve%2Fevents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyeve%2Fevents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyeve%2Fevents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyeve%2Fevents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyeve","download_url":"https://codeload.github.com/pyeve/events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247761050,"owners_count":20991531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["events","python"],"created_at":"2024-07-31T15:01:18.296Z","updated_at":"2025-04-08T01:36:57.276Z","avatar_url":"https://github.com/pyeve.png","language":"Python","readme":"Events \n------\n\nThe C# language provides a handy way to declare, subscribe to and fire events.\nTechnically, an event is a \"slot\" where callback functions (event handlers) can\nbe attached to - a process referred to as subscribing to an event. Here is\na handy package that encapsulates the core to event subscription and event\nfiring and feels like a \"natural\" part of the language.\n\n::\n \n    \u003e\u003e\u003e def something_changed(reason): \n    ...     print \"something changed because %s\" % reason \n\n    \u003e\u003e\u003e from events import Events\n    \u003e\u003e\u003e events = Events()\n    \u003e\u003e\u003e events.on_change += something_changed\n\nMultiple callback functions can subscribe to the same event. When the event is\nfired, all attached event handlers are invoked in sequence. To fire the event,\nperform a call on the slot: \n\n::\n\n    \u003e\u003e\u003e events.on_change('it had to happen')\n    'something changed because it had to happen'\n\nBy default, Events does not check if an event can be subscribed to and fired.\nYou can predefine events by subclassing Events and listing them. Attempts to\nsubscribe to or fire an undefined event will raise an EventsException.\n\n::\n\n    \u003e\u003e\u003e class MyEvents(Events):\n    ...     __events__ = ('on_this', 'on_that', )\n\n    \u003e\u003e\u003e events = MyEvents()\n\n    # this will raise an EventsException as `on_change` is unknown to MyEvents:\n    \u003e\u003e\u003e events.on_change += something_changed\n\nYou can also predefine events for a single Events instance by passing an\niterator to the constructor.\n\n::\n\n    \u003e\u003e\u003e events = Events(('on_this', 'on_that'))\n\n    # this will raise an EventsException as `on_change` is unknown to events:\n    \u003e\u003e\u003e events.on_change += something_changed\n\n\nUnsubscribing\n-------------\nThere may come a time when you no longer want to be notified of an event. In\nthis case, you unsubscribe in the natural counterpart to `+=` by using `-=`.\n\n::\n\n    # We no longer want to be notified, take us out of the event callback list\n    \u003e\u003e\u003e events.on_change -= something_changed\n\n\nYou may also want to unsubscribe for memory management reasons. The `Events()` instance\nwill hold a reference `something_changed`. If this is a member method of an object,\nand the lifetime of the `Events()` instance is greater than that object, it will keep\nit around longer than would be the normal case.\n\nDocumentation\n-------------\nComplete documentation is available at http://events.readthedocs.org\n\nInstalling\n----------\nEvents is on PyPI so all you need to do is:\n\n::\n\n    pip install events\n\nTesting\n-------\nJust run:\n\n::\n\n    python setup.py test\n\nOr use tox to test the package under all supported Pythons: 2.7, 3.4+\n\nLicensing\n----------\nEvents is BSD licensed. See the LICENSE_ for details.\n\nContributing\n------------\nPlease see the `Contribution Guidelines`_.\n\nAttribution\n-----------\nBased on the excellent recipe by `Zoran Isailovski`_, Copyright (c) 2005.\n\n.. _`Contribution Guidelines`: https://github.com/pyeve/events/blob/master/CONTRIBUTING.rst\n.. _LICENSE: https://github.com/pyeve/events/blob/master/LICENSE \n.. _`Zoran Isailovski`: http://code.activestate.com/recipes/410686/\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyeve%2Fevents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyeve%2Fevents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyeve%2Fevents/lists"}