basicevents-2.0.9


توضیحات

python events non-blocking
ویژگی مقدار
سیستم عامل -
نام فایل basicevents-2.0.9
نام basicevents
نسخه کتابخانه 2.0.9
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Alberto Galera Jimenez
ایمیل نویسنده galerajimenez@gmail.com
آدرس صفحه اصلی https://github.com/agalera/basicevents
آدرس اینترنتی https://pypi.org/project/basicevents/
مجوز GPL
|pythonversions| |Code Climate| |Codecov| |Travis| |License| BasicEvents =========== python basic events send non-blocking Install ------- .. code:: bash pip install basicevents Link pypi: https://pypi.python.org/pypi/basicevents Example ------- .. code:: python # recommeded check all examples from basicevents import (subscribe, send_thread, send_queue, send_blocking, add_subscribe, send, run) @subscribe("pepito") def example(*args, **kwargs): print "recv signal, values:", args, kwargs def example2(*args, **kwargs): print "manual subscribe" # manual subscribe add_subscribe("pepito", example2) # add to queue signals (non-blocking) send("pepito", 1, 2, 3, example="added queue") # add to queue signals (non-blocking) send_queue("pepito", 1, 2, 3, example="added queue") # create new thread for this request (non-blocking) send_thread("pepito", 1, 2, 3, example="new thread") # This is blocking send_blocking("pepito", 1, 2, 3, example="blocking") run() send("STOP") Documentation ------------- Functions ~~~~~~~~~ @subscribe(name\_event) With this decorator you can subscribe to all events that are sent to name\_event. manual subscribe add\_subscribe(name\_event, function) - added in queue (non-blocking) send\_queue(name\_event, \*args, \*\*kwargs) - run in new thread (non-blocking) send\_thread(name\_event, \*args, \*\*kwargs) - run blocking (blocking) send\_blocking(name\_event, \*args, \*\*kwargs) - Note: Currently running in individual process. Attributes events ~~~~~~~~~~~~~~~~~ - events.subs return: .. code:: python {'juanito': [<function __main__.example2>], 'pepito': [<function __main__.example>]} - events.queue return queue queue is processed automatically and do not need to access this attribute, but if you want you can use https://docs.python.org/2/library/queue.html - events.timeout return int \`\`\` - events.logger return function You can change the function that is executed when an exception occurs. Uses default print You can modify it if you wish. .. code:: python from basicevents import events events.logger = function - events.send return function You can change the function send (It is a link). default is events.send\_queue .. code:: python from basicevents import events events.send = events.send_blocking # or other functions - these parameters are too, have documented above: .. code:: python add_subscribe, send, send_queue, send_thread, send_blocking .. |pythonversions| image:: https://img.shields.io/pypi/pyversions/basicevents.svg :target: https://pypi.python.org/pypi/basicevents .. |Code Climate| image:: https://img.shields.io/codeclimate/github/agalera/basicevents.svg :target: https://codeclimate.com/github/agalera/basicevents .. |Codecov| image:: https://img.shields.io/codecov/c/github/agalera/basicevents.svg :target: https://codecov.io/github/agalera/basicevents .. |Travis| image:: https://img.shields.io/travis/agalera/basicevents.svg :target: https://travis-ci.org/agalera/basicevents .. |License| image:: https://img.shields.io/pypi/l/basicevents.svg :target: http://www.gnu.org/licenses/gpl-3.0.txt CHANGELOG ========= 2.0.12(2017-06-05) ------------------ - revert task\_done() (not exists in multiprocessing) 2.0.11(2017-06-05) ------------------ - task\_done() 2.0.10(2017-04-07) ------------------ - graceful stop 2.0.9(2017-04-03) ----------------- - Fix pip version 2.0.8(2017-03-31) ----------------- - Fix default argument 2.0.7(2017-03-31) ----------------- - Support waiting for stop loop 2.0.6(2016-10-20) ----------------- - events to Events - correct shutdown 2.0.5(2016-10-20) ----------------- - events to Events 2.0.4(2016-10-20) ----------------- - Update document - Remove old code 2.0.3(2016-10-19) ----------------- - PEP8 2.0.2(2016-09-28) ----------------- - It lets you send messages from different processes. (Required to import of basicevents before starting the process) 2.0.1 (2016-07-06) ------------------ - Fix tests 2.0.0 (2016-07-05) ------------------ - Require call run() for init events loop 1.2.5 (2016-06-15) ------------------ - Fix MANIFEST.in 1.2.4 (2015-10-15) ------------------ - Fix support python 3 1.2.3 (2015-10-14) ------------------ - Remove 3.2 support - Prepare travis 1.2.2 (2015-10-14) ------------------ - Fix readme 1.2.1 (2015-10-14) ------------------ - Remove bad examples - Update readme 1.2.0 (2015-09-22) ------------------ - You can change the method that executes when an exception occurs - Remove deprecated functions - Send internally calls send\_queue - Official support python 3.5.0 - Permit change default send 1.1.3 (2015-08-14) ------------------ - Fix bug in add\_subcribe 1.1.1 (2015-08-14) ------------------ - Try fix changelog in pypi 1.1.0 (2015-08-14) ------------------ - Refactor code - Added new functions: send\_queue, send\_thread, send\_blocking, add\_subscribe 1.0.2 (2015-08-14) ------------------ - increase performance function send (19%+) - increase performance subscribe (2%+) 1.0.1 (2015-08-13) ------------------ - fix pip install basicevents 1.0.0 (2015-08-13) ------------------ - Now you can run blocker way events - break compatibility function send (check documentation) 0.1.5 (2015-08-12) ------------------ - update documentation 0.1.4 (2015-08-12) ------------------ - update documentation - remove instant key in kwargs 0.1.3 (2015-08-12) ------------------ - Added changelog - Auto convert md to rst in setup.py


نحوه نصب


نصب پکیج whl basicevents-2.0.9:

    pip install basicevents-2.0.9.whl


نصب پکیج tar.gz basicevents-2.0.9:

    pip install basicevents-2.0.9.tar.gz