{ "info": { "author": "Nanda Bhat", "author_email": "n89nanda@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Flask", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7" ], "description": "pyeventbus\n=========================\n\n.. image:: https://travis-ci.org/n89nanda/pyeventbus.svg?branch=master\n :target: https://travis-ci.org/n89nanda/pyeventbus\n \npyeventbus is a publish/subscribe event bus for Python 2.7.\n\n+ simplifies the communication between python classes \n+ decouples event senders and receivers\n+ performs well threads, greenlets, queues and concurrent processes\n+ avoids complex and error-prone dependencies and life cycle issues\n+ makes code simpler\n+ has advanced features like delivery threads, workers and spawning different processes, etc.\n+ is tiny (3KB archive) \n\npyeventbus in 3 steps:\n\n1. Define events::\n \n class MessageEvent:\n # Additional fields and methods if needed\n def __init__(self):\n pass\n \n2. Prepare subscribers: Declare and annotate your subscribing method, optionally specify a thread mode::\n\n from pyeventbus import *\n \n @subscribe(onEvent=MessageEvent)\n def func(self, event):\n # Do something\n pass\n \n \n Register your subscriber. For example, if you want to register a class in Python::\n \n from pyeventbus import *\n \n class MyClass:\n def __init__(self):\n pass\n \n def register(self, myclass):\n PyBus.Instance().register(myclass, self.__class__.__name__)\n \n # then during initilization\n \n myclass = MyClass()\n myclass.register(myclass)\n \n3. Post events::\n \n from pyeventbus import *\n \n class MyClass:\n def __init__(self):\n pass\n \n def register(self, myclass):\n PyBus.Instance().register(myclass, self.__class__.__name__)\n \n def postingAnEvent(self):\n PyBus.Instance().post(MessageEvent())\n \n myclass = MyClass()\n myclass.register(myclass)\n myclass.post()\n \n\nModes: pyeventbus can run the subscribing methods in 5 different modes\n\n1. POSTING::\n\n Runs the method in the same thread as posted. For example, if an event is posted from main thread, the subscribing method also runs in the main thread. If an event is posted in a seperate thread, the subscribing method runs in the same seperate method\n \n This is the default mode, if no mode has been provided::\n \n @subscribe(threadMode = Mode.POSTING, onEvent=MessageEvent)\n def func(self, event):\n # Do something\n pass\n \n2. PARALLEL::\n \n Runs the method in a seperate python thread::\n \n @subscribe(threadMode = Mode.PARALLEL, onEvent=MessageEvent)\n def func(self, event):\n # Do something\n pass\n \n3. GREENLET::\n\n Runs the method in a greenlet using gevent library::\n \n @subscribe(threadMode = Mode.GREENLET, onEvent=MessageEvent)\n def func(self, event):\n # Do something\n pass\n \n4. BACKGROUND::\n \n Adds the subscribing methods to a queue which is executed by workers::\n \n @subscribe(threadMode = Mode.BACKGROUND, onEvent=MessageEvent)\n def func(self, event):\n # Do something\n pass\n\n\n3. CONCURRENT::\n\n Runs the method in a seperate python process::\n \n @subscribe(threadMode = Mode.CONCURRENT, onEvent=MessageEvent)\n def func(self, event):\n # Do something\n pass\n \n \n \nAdding pyeventbus to your project::\n\n pip install pyeventbus\n\n \nExample::\n \n git clone https://github.com/n89nanda/pyeventbus.git\n \n cd pyeventbus\n \n virtualenv venv\n \n source venv/bin/activate\n \n pip install pyeventbus\n \n python example.py\n \n\nBenchmarks and Performance::\n \n \n Refer /pyeventbus/tests/benchmarks.txt for performance benchmarks on CPU, I/O and networks heavy tasks.\n \n Run /pyeventbus/tests/test.sh to generate the same benchmarks.\n\nInspiration\n\n Inspired by Eventbus from greenrobot: https://github.com/greenrobot/EventBus\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/n89nanda/pyeventbus", "keywords": "python eventbus with threading and concurrency support", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyeventbus", "package_url": "https://pypi.org/project/pyeventbus/", "platform": "", "project_url": "https://pypi.org/project/pyeventbus/", "project_urls": { "Homepage": "https://github.com/n89nanda/pyeventbus" }, "release_url": "https://pypi.org/project/pyeventbus/0.5/", "requires_dist": null, "requires_python": "", "summary": "A Python EventBus", "version": "0.5" }, "last_serial": 3594921, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "895300a1f041bfc96f46a41376b1ee6f", "sha256": "fbc89e83ca44480908780ee0885f94e5ea636d4cbef557297d7a89903dd8cc83" }, "downloads": -1, "filename": "pyeventbus-0.1.tar.gz", "has_sig": false, "md5_digest": "895300a1f041bfc96f46a41376b1ee6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3214, "upload_time": "2018-02-01T22:26:23", "url": "https://files.pythonhosted.org/packages/2e/94/6403dfae2cad6e9b9f21b6f5545e855f1298d404f0cb2d30d8efd7c0f64b/pyeventbus-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "d216a0b2003a98cddb6ceb47611690f5", "sha256": "808247cf19ced66522c2dacbb1c75ac2bd3c7d5f016de5e2afc583905c642182" }, "downloads": -1, "filename": "pyeventbus-0.2.tar.gz", "has_sig": false, "md5_digest": "d216a0b2003a98cddb6ceb47611690f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4429, "upload_time": "2018-02-02T22:02:58", "url": "https://files.pythonhosted.org/packages/29/17/186413c432f49c32548a1cdaf3eb5d033d703e0b2a79d51fb0eff780f1dd/pyeventbus-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "aa4978c522398af4ba76069d54b67a1c", "sha256": "01c35858536ffef17b082ce0090d4be7e9182b77d4e51298e6feb44dca2fe0b6" }, "downloads": -1, "filename": "pyeventbus-0.3.tar.gz", "has_sig": false, "md5_digest": "aa4978c522398af4ba76069d54b67a1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4695, "upload_time": "2018-02-19T05:44:02", "url": "https://files.pythonhosted.org/packages/01/6e/1dd62820c5582724c6cfbfe42e44585367cffce799e3f7283e636e2fae36/pyeventbus-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "989150f794af48039cd3faedfeced584", "sha256": "6a33f9ae2ed7a40425cd17a671f38629d2417095df0d17cd87487e742abff470" }, "downloads": -1, "filename": "pyeventbus-0.4.tar.gz", "has_sig": false, "md5_digest": "989150f794af48039cd3faedfeced584", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4676, "upload_time": "2018-02-19T05:47:49", "url": "https://files.pythonhosted.org/packages/e2/f2/97025d549d326e579d1745010cc0407dc0e801091f038bf0b56f97a0ad97/pyeventbus-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "12964bef9b90598178e9497bcc97bc2e", "sha256": "302262771599f8c6eb04d30bb07631ddad5257ec9adaeebc79e64f603e299465" }, "downloads": -1, "filename": "pyeventbus-0.5.tar.gz", "has_sig": false, "md5_digest": "12964bef9b90598178e9497bcc97bc2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4683, "upload_time": "2018-02-19T05:52:33", "url": "https://files.pythonhosted.org/packages/10/36/533f0338be7155364b334b8f613087f7995d0df6469486c779fa729b1ce5/pyeventbus-0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "12964bef9b90598178e9497bcc97bc2e", "sha256": "302262771599f8c6eb04d30bb07631ddad5257ec9adaeebc79e64f603e299465" }, "downloads": -1, "filename": "pyeventbus-0.5.tar.gz", "has_sig": false, "md5_digest": "12964bef9b90598178e9497bcc97bc2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4683, "upload_time": "2018-02-19T05:52:33", "url": "https://files.pythonhosted.org/packages/10/36/533f0338be7155364b334b8f613087f7995d0df6469486c779fa729b1ce5/pyeventbus-0.5.tar.gz" } ] }