events

Python Event Handling the C# Style

https://github.com/pyeve/events

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary

Keywords

events python
Last synced: 6 months ago · JSON representation

Repository

Python Event Handling the C# Style

Basic Info
Statistics
  • Stars: 327
  • Watchers: 15
  • Forks: 31
  • Open Issues: 10
  • Releases: 0
Topics
events python
Created almost 13 years ago · Last pushed over 2 years ago
Metadata Files
Readme Changelog Contributing License Authors

README.rst

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', )

    >>> events = MyEvents()

    # this will raise an EventsException as `on_change` is unknown to MyEvents:
    >>> events.on_change += something_changed

You can also predefine events for a single Events instance by passing an
iterator to the constructor.

::

    >>> events = Events(('on_this', 'on_that'))

    # this will raise an EventsException as `on_change` is unknown to events:
    >>> events.on_change += something_changed


Unsubscribing
-------------
There may come a time when you no longer want to be notified of an event. In
this case, you unsubscribe in the natural counterpart to `+=` by using `-=`.

::

    # We no longer want to be notified, take us out of the event callback list
    >>> events.on_change -= something_changed


You may also want to unsubscribe for memory management reasons. The `Events()` instance
will hold a reference `something_changed`. If this is a member method of an object,
and the lifetime of the `Events()` instance is greater than that object, it will keep
it around longer than would be the normal case.

Documentation
-------------
Complete documentation is available at http://events.readthedocs.org

Installing
----------
Events is on PyPI so all you need to do is:

::

    pip install events

Testing
-------
Just run:

::

    python setup.py test

Or use tox to test the package under all supported Pythons: 2.7, 3.4+

Licensing
----------
Events is BSD licensed. See the LICENSE_ for details.

Contributing
------------
Please see the `Contribution Guidelines`_.

Attribution
-----------
Based on the excellent recipe by `Zoran Isailovski`_, Copyright (c) 2005.

.. _`Contribution Guidelines`: https://github.com/pyeve/events/blob/master/CONTRIBUTING.rst
.. _LICENSE: https://github.com/pyeve/events/blob/master/LICENSE 
.. _`Zoran Isailovski`: http://code.activestate.com/recipes/410686/

Owner

  • Name: eve
  • Login: pyeve
  • Kind: organization

REST API framework designed for human beings

GitHub Events

Total
  • Watch event: 2
Last Year
  • Watch event: 2

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 102
  • Total Committers: 10
  • Avg Commits per committer: 10.2
  • Development Distribution Score (DDS): 0.186
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Nicola Iarocci n****a@n****m 83
ajpen a****t@g****m 6
Øyvind Heddeland Instefjord i****d@o****m 3
Michael Kennedy m****y@g****m 3
Cailean Parker c****n@k****m 2
petr.jasek p****k@s****g 1
genericmoniker e****c@e****t 1
Lucas Fernando Nunes l****s@g****m 1
Evan Klitzke e****n@e****g 1
Thomas Hanssen Nornes t****s@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 13
  • Total pull requests: 14
  • Average time to close issues: 11 months
  • Average time to close pull requests: 18 days
  • Total issue authors: 11
  • Total pull request authors: 11
  • Average comments per issue: 0.92
  • Average comments per pull request: 1.64
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • nicolaiarocci (2)
  • eabase (2)
  • genericmoniker (1)
  • DavidCurtiss (1)
  • kallqvist (1)
  • ajpen (1)
  • stanislavlevin (1)
  • ffischer1984 (1)
  • Liriel (1)
  • sander76 (1)
  • tawmas (1)
Pull Request Authors
  • ajpen (3)
  • CaileanMParker (2)
  • ffischer1984 (1)
  • mikeckennedy (1)
  • mdbetancourt (1)
  • eklitzke (1)
  • genericmoniker (1)
  • ThreePinkApples (1)
  • petrjasek (1)
  • lucasfcnunes (1)
  • thomashn (1)
Top Labels
Issue Labels
enhancement (2)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 23,268,209 last-month
  • Total docker downloads: 5
  • Total dependent packages: 19
    (may contain duplicates)
  • Total dependent repositories: 112
    (may contain duplicates)
  • Total versions: 9
  • Total maintainers: 1
pypi.org: events

Bringing the elegance of C# EventHandler to Python

  • Versions: 7
  • Dependent Packages: 18
  • Dependent Repositories: 112
  • Downloads: 23,268,209 Last month
  • Docker Downloads: 5
Rankings
Dependent packages count: 0.6%
Downloads: 0.9%
Dependent repos count: 1.4%
Average: 3.0%
Stargazers count: 3.5%
Docker downloads count: 4.6%
Forks count: 7.1%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: events

Bringing the elegance of C# EventHandler to Python

  • Versions: 2
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Stargazers count: 20.1%
Average: 27.9%
Forks count: 28.5%
Dependent packages count: 28.8%
Dependent repos count: 34.0%
Last synced: 6 months ago

Dependencies

setup.py pypi