{ "info": { "author": "Nanda Bhat, Flavien Vernier", "author_email": "n89nanda@gmail.com, flavien.vernier@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 :: 3" ], "description": "pyeventbus3\n=========================\n\n.. image:: https://travis-ci.org/n89nanda/pyeventbus.svg?branch=master\n :target: https://travis-ci.org/n89nanda/pyeventbus\n\npyeventbus3 is a publish/subscribe event bus for Python 3. (Fork of pyeventbus 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\npyeventbus3 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 pyeventbus3.pyeventbus3 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 pyeventbus3.pyeventbus3 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 pyeventbus3.pyeventbus3 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.postingAnEvent()\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 pyeventbus3\n\n\nExample::\n\n git clone https://github.com/FlavienVernier/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\n Performance comparison between all the modes with Python and Cython\n\n.. image:: pyeventbus/tests/Benchmarks.png\n :width: 2000px\n :align: center\n :height: 1000px\n :alt: alternate text\n\nInspiration\n\n Inspired by Eventbus from greenrobot: https://github.com/greenrobot/EventBus\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/FlavienVernier/pyeventbus", "keywords": "python eventbus with threading and concurrency support", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyeventbus3", "package_url": "https://pypi.org/project/pyeventbus3/", "platform": "", "project_url": "https://pypi.org/project/pyeventbus3/", "project_urls": { "Homepage": "https://github.com/FlavienVernier/pyeventbus" }, "release_url": "https://pypi.org/project/pyeventbus3/0.9/", "requires_dist": [ "gevent" ], "requires_python": "", "summary": "A Python EventBus", "version": "0.9" }, "last_serial": 5949156, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "36ff1102924043208ba70159794071ef", "sha256": "d43739939b4670a564beaaa86f6a9482705dca537811b972bec56ac159116dda" }, "downloads": -1, "filename": "pyeventbus3-0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "36ff1102924043208ba70159794071ef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11010, "upload_time": "2019-10-09T11:12:57", "url": "https://files.pythonhosted.org/packages/09/aa/c3c50554bcf5e50ea444191837fe9033b1652ff071c4453a5e7e42a818b9/pyeventbus3-0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "99455c9d0c4d4cccccf013f1c2950765", "sha256": "fb27e9d439a5b90cfad1a9947b1160ad4402d6d3af12384b4c30840eaa98a244" }, "downloads": -1, "filename": "pyeventbus3-0.9.tar.gz", "has_sig": false, "md5_digest": "99455c9d0c4d4cccccf013f1c2950765", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4883, "upload_time": "2019-10-09T11:13:01", "url": "https://files.pythonhosted.org/packages/85/7f/96265f2af31d968715e91d8b45c56e149c75c32c0491e5d4ad7f8bc112c5/pyeventbus3-0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "36ff1102924043208ba70159794071ef", "sha256": "d43739939b4670a564beaaa86f6a9482705dca537811b972bec56ac159116dda" }, "downloads": -1, "filename": "pyeventbus3-0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "36ff1102924043208ba70159794071ef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11010, "upload_time": "2019-10-09T11:12:57", "url": "https://files.pythonhosted.org/packages/09/aa/c3c50554bcf5e50ea444191837fe9033b1652ff071c4453a5e7e42a818b9/pyeventbus3-0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "99455c9d0c4d4cccccf013f1c2950765", "sha256": "fb27e9d439a5b90cfad1a9947b1160ad4402d6d3af12384b4c30840eaa98a244" }, "downloads": -1, "filename": "pyeventbus3-0.9.tar.gz", "has_sig": false, "md5_digest": "99455c9d0c4d4cccccf013f1c2950765", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4883, "upload_time": "2019-10-09T11:13:01", "url": "https://files.pythonhosted.org/packages/85/7f/96265f2af31d968715e91d8b45c56e149c75c32c0491e5d4ad7f8bc112c5/pyeventbus3-0.9.tar.gz" } ] }