Skip to content

Commit

Permalink
bump version to 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaiarocci committed Oct 31, 2020
1 parent 77a8bbc commit da3061f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Here you can see the full list of changes between each Events release.
In development
--------------

- hic sunt leones

Version 0.4
-----------

Released on October 31, 2020

- Add Python 3.7 and 3.8 to CI matrix.
- Drop Python 2.6 and Python 3.3 and pypy from CI matrix.
- Add section on unsubscribing to documentation (Michael Kennedy)
Expand Down
45 changes: 23 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
Events
~~~~~~
.. image:: https://secure.travis-ci.org/pyeve/events.png?branch=master
:target: https://secure.travis-ci.org/pyeve/events
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.

.. code-block:: pycon
::
>>> def something_changed(reason):
... print "something changed because %s" % reason
...

>>> from events import Events
>>> events = Events()
Expand All @@ -23,17 +20,17 @@ 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:

.. code-block:: pycon
::

>>> 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.
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.

.. code-block:: pycon
::

>>> class MyEvents(Events):
... __events__ = ('on_this', 'on_that', )

Expand All @@ -42,9 +39,10 @@ subscribe to or fire an undefined event will raise an EventsException.
# 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.
You can also predefine events for a single Events instance by passing an
iterator to the constructor.

.. code-block:: pycon
::

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

Expand All @@ -54,11 +52,10 @@ You can also predefine events for a single Events instance by passing an iterato

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 `-=`.

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 `-=`.

.. code-block:: pycon
::

# We no longer want to be notified, take us out of the event callback list
>>> events.on_change -= something_changed
Expand All @@ -75,20 +72,24 @@ Complete documentation is available at http://events.readthedocs.org

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

::

pip install events

Testing
-------
Just run: ::
Just run:

::

python setup.py test

Or use tox to test the package under all supported Pythons: 2.6, 2.7, 3.3, 3.4, 3.5 and 3.6.
Or use tox to test the package under all supported Pythons: 2.7, 3.4+

License
-------
Licenseing
----------
Events is BSD licensed. See the LICENSE_ for details.

Contributing
Expand All @@ -99,6 +100,6 @@ 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/
.. _`Contribution Guidelines`: https://github.com/pyeve/events/blob/master/CONTRIBUTING.rst
2 changes: 1 addition & 1 deletion events/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from .events import Events, EventsException

__version__ = '0.3' # test
__version__ = '0.4'

__all__ = [
Events.__name__,
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from setuptools import setup, find_packages

DESCRIPTION = ("Bringing the elegance of C# EventHandler to Python")
LONG_DESCRIPTION = open('README.rst').read()
VERSION = __import__('events').__version__
with open("README.rst") as f:
LONG_DESCRIPTION = f.read()

setup(
name='Events',
Expand All @@ -14,7 +15,7 @@
author='Nicola Iarocci',
author_email='nicola@nicolaiarocci.com',
url='http://github.com/pyeve/events',
license=open('LICENSE').read(),
license="BSD",
platforms=["any"],
packages=find_packages(),
include_package_data=True,
Expand All @@ -28,12 +29,12 @@
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Software Development',
],
)

0 comments on commit da3061f

Please sign in to comment.