Package: basicevents
BasicEventspython basic events send non-blockingInstallpipinstallbasiceventsLink pypi:https://pypi.python.org/pypi/basiceventsExample# recommeded check all examplesfrombasiceventsimport(subscribe,send_thread,send_queue,send_blocking,add_subscribe,send,run)@subscribe("pepito")defexample(*args,**kwargs):print"recv signal, values:",args,kwargsdefexample2(*args,**kwargs):print"manual subscribe"# manual subscribeadd_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 blockingsend_blocking("pepito",1,2,3,example="blocking")run()send("STOP")DocumentationFunctions@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 eventsevents.subsreturn:{'juanito':[<function__main__.example2>],'pepito':[<function__main__.example>]}events.queuereturn queuequeue is processed automatically and do not need to access this
attribute, but if you want you can usehttps://docs.python.org/2/library/queue.htmlevents.timeoutreturn int```events.loggerreturn functionYou can change the function that is executed when an exception occurs.
Uses default print You can modify it if you wish.frombasiceventsimporteventsevents.logger=functionevents.sendreturn functionYou can change the function send (It is a link). default is
events.send_queuefrombasiceventsimporteventsevents.send=events.send_blocking# or other functionsthese parameters are too, have documented above:add_subscribe,send,send_queue,send_thread,send_blockingCHANGELOG2.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 stop2.0.9(2017-04-03)Fix pip version2.0.8(2017-03-31)Fix default argument2.0.7(2017-03-31)Support waiting for stop loop2.0.6(2016-10-20)events to Eventscorrect shutdown2.0.5(2016-10-20)events to Events2.0.4(2016-10-20)Update documentRemove old code2.0.3(2016-10-19)PEP82.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 tests2.0.0 (2016-07-05)Require call run() for init events loop1.2.5 (2016-06-15)Fix MANIFEST.in1.2.4 (2015-10-15)Fix support python 31.2.3 (2015-10-14)Remove 3.2 supportPrepare travis1.2.2 (2015-10-14)Fix readme1.2.1 (2015-10-14)Remove bad examplesUpdate readme1.2.0 (2015-09-22)You can change the method that executes when an exception occursRemove deprecated functionsSend internally calls send_queueOfficial support python 3.5.0Permit change default send1.1.3 (2015-08-14)Fix bug in add_subcribe1.1.1 (2015-08-14)Try fix changelog in pypi1.1.0 (2015-08-14)Refactor codeAdded new functions: send_queue, send_thread, send_blocking,
add_subscribe1.0.2 (2015-08-14)increase performance function send (19%+)increase performance subscribe (2%+)1.0.1 (2015-08-13)fix pip install basicevents1.0.0 (2015-08-13)Now you can run blocker way eventsbreak compatibility function send (check documentation)0.1.5 (2015-08-12)update documentation0.1.4 (2015-08-12)update documentationremove instant key in kwargs0.1.3 (2015-08-12)Added changelogAuto convert md to rst in setup.py