eventize-0.4.4
توضیحات
Add events to object methods and attributes
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | eventize-0.4.4 |
| نام | eventize |
| نسخه کتابخانه | 0.4.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Grégory Salvan |
| ایمیل نویسنده | apieum@gmail.com |
| آدرس صفحه اصلی | http://www.python.org/pypi/eventize |
| آدرس اینترنتی | https://pypi.org/project/eventize/ |
| مجوز | LGPL |
********
Eventize
********
.. image:: https://img.shields.io/pypi/v/eventize.svg
:target: https://pypi.python.org/pypi/eventize
Eventize permits to listen to *"before"* and *"after"* methods events and *"on_get"*, *"on_change"*, *"on_set"*, *"on_del"* attributes events.
**Features:**
* Can be used as a simple subject/observer pattern
* Conditional events
* Use descriptors to lazily and unobstrusively listen to "on_get", "on_change","on_set", "on_del" events on attributes and "before" and "after" events on methods.
* Precise callbacks inheritance (see Subject)
* Statically and dynamically customizable (via inheritance, pattern visitor over a "*modifier*" protocol, decorators...)
**Fine grained event dispatcher**
It can listen to events at 3 levels (by order of execution):
* **Descriptor Class**: for all classes which use the given Attribute or Method descriptor class
* **Descriptor Instance**: for all objects of a given class
* **Object instance**: for the given object attribute value or method
---------------------------------------------------------------------
**Table of Contents**
.. contents::
:local:
:depth: 1
:backlinks: none
=============
Installation
=============
Install it from pypi::
pip install eventize
or from sources::
git clone git@github.com:apieum/eventize.git
cd eventize
python setup.py install
=====
Usage
=====
`See documentation <http://eventize.readthedocs.org/>`_
===========
Development
===========
Contributions are greatly appreciated.
Please use `github <https://github.com/apieum/eventize>`_ (issue tracker, pull requests...) or contact me at apieum [at] gmail [dot] com
--------
Testing
--------
Tests are my specs so code (except refactorings) without tests won't probably be accepted.
If you want to contribute please add tests.
Test recommended requirements::
pip install -r dev-requirements.txt
Sometimes --spec-color doesn't function.
You should uninstall nosecolor and nosespec then reinstall nosecolor and nosespec separatly (nosecolor first).
You can fix it like this::
pip uninstall nosespec nosecolor
pip install nosecolor && pip install nosespec
In order to have fast feedback with TDD loops, I develop with two virtualenvs (2.7 and 3.x python versions) launched in a splited shell (tmux) which runs tests each time a file changes.
Use the code below with option --with-watch to launch tests this way.
Launching tests::
git clone git@github.com:apieum/eventize.git
cd eventize
nosetests --with-spec --spec-color ./eventize
# or with watch
# nosetests --with-spec --spec-color --with-watch ./eventize
--------------
Documentation
--------------
Documentation is generated by sphinx from restructured text localized in doc/source. It is build by make (see doc/Makefile).
Except to explain implementation choices (why), **please avoid comments in code**. It aims at keeping focus on coding and avoiding outdated comments.
Keep long names (vars, functions, classes...) and explicit tests names (complete sentences) to have understandable code.
Building doc::
git clone git@github.com:apieum/eventize.git
cd eventize/eventize/doc
make all # or make *target* (see in Makefile for *target* or type make)
----------------------
Continuous Integration
----------------------
CI is made by travis for different python versions (trying to maintain compatibility with v2 python).
It checks:
* test suites (nosetest)
* rst-lint this README
* doc building
* `code coverage <https://coveralls.io/r/apieum/eventize>`_
.. image:: https://app.travis-ci.com/apieum/eventize.svg?branch=master
:target: https://app.travis-ci.com/github/apieum/eventize
.. image:: https://coveralls.io/repos/github/apieum/eventize/badge.svg?branch=master
:target: https://coveralls.io/github/apieum/eventize?branch=master
نحوه نصب
نصب پکیج whl eventize-0.4.4:
pip install eventize-0.4.4.whl
نصب پکیج tar.gz eventize-0.4.4:
pip install eventize-0.4.4.tar.gz