{ "info": { "author": "Dan Bradham", "author_email": "danielbradham@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. image:: https://raw.github.com/danbradham/bands/master/bands_sm.png\r\n :target: https://github.com/danbradham/bands\r\n :alt: Bands\r\n\r\n.. image:: https://img.shields.io/github/license/danbradham/bands.svg?style=flat-square\r\n :target: https://github.com/danbradham/bands/blob/master/LICENSE\r\n :alt: License\r\n\r\n.. image:: https://img.shields.io/travis/danbradham/bands.svg?style=flat-square\r\n :target: https://travis-ci.org/danbradham/bands\r\n :alt: Travis\r\n\r\n=====\r\nbands\r\n=====\r\nAnother python messaging library\r\n\r\nThere are ton of python message passing / signal dispatching libraries out\r\nthere. Blinker, pysignal, dispatch, pydispatcher, louie, the list goes on and\r\non. All of these libraries are fine. This library is okay too.\r\n\r\nFeatures\r\n========\r\n\r\n- bound and unbound Channels\r\n- Pluggable Dispatchers\r\n- Bands - groups of Channels with their own dispatcher\r\n\r\nWorking with an unbound Channel\r\n===============================\r\n\r\n.. code-block:: python\r\n\r\n >>> import bands\r\n\r\n >>> def on_alert(message):\r\n ... return message.upper()\r\n\r\n >>> alert = bands.channel('alert')\r\n >>> alert.connect(on_alert)\r\n >>> alert.send('alert!!')\r\n ['ALERT!!']\r\n\r\nAlternatively you can send your message via `bands.send`...\r\n\r\n.. code-block:: python\r\n\r\n >>> bands.send('alert', 'ALERT!!')\r\n ['ALERT!!']\r\n\r\nThe send method forwards `*args` and `**kwargs` to all of the Channel's\r\nreceivers.\r\n\r\nWorking with bound Channel's\r\n============================\r\nA `Channel` is *bound* when it's `parent` attribute is set. If you use\r\n`bands.channel` as a class attribute, each instance of your class will have\r\nit's own bound `Channel`. This is very similar to the way Python methods work,\r\nexcept with bound Channels you're gauranteed to get the same\r\nbound Channel instance everytime you access it.\r\n\r\n.. code-block:: python\r\n\r\n >>> import bands\r\n\r\n >>> class Component(object):\r\n ... started = bands.channel('started')\r\n ... def __init__(self, name):\r\n ... self.name = name\r\n ... self.started.connect(self.on_started)\r\n ... def on_started(self):\r\n ... return self.name + '.on_started'\r\n\r\n >>> Component.started # doctest:+ELLIPSIS\r\n (identifier='started')\r\n >>> c1 = Component('one')\r\n >>> c1.started # doctest:+ELLIPSIS\r\n (identifier='started')\r\n >>> c2 = Component('two')\r\n >>> c2.started # doctest:+ELLIPSIS\r\n (identifier='started')\r\n >>> c1.started.send()\r\n ['one.on_started']\r\n >>> c2.started.send()\r\n ['two.on_started']\r\n >>> Component.started.send()\r\n ['one.on_started', 'two.on_started']\r\n >>> bands.send('started')\r\n ['one.on_started', 'two.on_started']\r\n\r\nFrom the above example, we can see that each bound Channel has it's own\r\nsubscribers. Additionally, if you call send on the unbound Channel, all bound\r\nchannel receivers will also be notified. We can also use bands.send to send\r\nmessages by identifier.\r\n\r\n\r\nWorking with a Band\r\n===================\r\nA `Band` is a group of channels with a `Dispatcher` used to actually execute a\r\nChannel's receivers. Messages sent to one `Band` will not reach another\r\n`Band`'s Channels or receivers.\r\n\r\nThe api functions, `bands.channel` and `bands.send`, delegate their calls to\r\nthe active band. The active band defaults to the default Band accessible via\r\nthe DEFAULT_BAND constant. You can set the active band with `bands.use_band`,\r\nand get the active band with `bands.get_band`. It may be wise to have a Band\r\nper application or library.\r\n\r\n.. code-block:: python\r\n\r\n >>> import bands\r\n >>> my_band = bands.Band()\r\n >>> chan = my_band.channel('one')\r\n\r\nYou can also provide your own Dispatcher to my_band. Here is an example of a\r\nLoggingDispatcher.\r\n\r\n.. code-block:: python\r\n\r\n >>> import bands\r\n >>> import logging\r\n\r\n >>> class LoggingDispatcher(bands.Dispatcher):\r\n ... def __init__(self, name):\r\n ... self.log = logging.getLogger(name)\r\n ... def before_dispatch(self, ctx):\r\n ... self.log.debug('Sending %s' % ctx.identifier)\r\n\r\n >>> my_band = bands.Band(LoggingDispatcher('my_band'))\r\n\r\nThe above LoggingDispatcher will log a debug message before every message is\r\ndispatched to a channel's receivers.\r\n\r\n\r\nInstallation\r\n============\r\n\r\n.. code-block:: console\r\n\r\n > pip install bands\r\n\r\n\r\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/danielbradham/bands.git", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "bands", "package_url": "https://pypi.org/project/bands/", "platform": "", "project_url": "https://pypi.org/project/bands/", "project_urls": { "Homepage": "https://github.com/danielbradham/bands.git" }, "release_url": "https://pypi.org/project/bands/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "Another message passing library.", "version": "0.1.3" }, "last_serial": 3962946, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "572fa126006113e5d206f13ee8f43cd2", "sha256": "7f84542043b8b01963e3be3464928e59d4ad10434911ec27cf55ce6ecabefb58" }, "downloads": -1, "filename": "bands-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "572fa126006113e5d206f13ee8f43cd2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6340, "upload_time": "2018-04-23T20:15:39", "url": "https://files.pythonhosted.org/packages/e9/ca/e8d3e4e548b19d0e5a46c47e53f6d0c534acd17ec2932691ce240be65f2f/bands-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3067cbb6f80850c48f9af4622f0ec780", "sha256": "0fde90d6d3daf49d322128611c703fd8e4fee3cd98cadd29e4413f0bda0a021f" }, "downloads": -1, "filename": "bands-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3067cbb6f80850c48f9af4622f0ec780", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6262, "upload_time": "2018-04-23T20:15:40", "url": "https://files.pythonhosted.org/packages/0c/7c/e84bc5d9f250ca13fbfd561e491991801556ec481efa9a67f0ff0060e03d/bands-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2c006d550919c918fbf1e982816f9500", "sha256": "0bf46881497bb978e3816aa8dcb704744b5e883e5928dcc72cb60225828a2e35" }, "downloads": -1, "filename": "bands-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2c006d550919c918fbf1e982816f9500", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6446, "upload_time": "2018-04-23T21:33:27", "url": "https://files.pythonhosted.org/packages/2a/02/bfe0ef5c9463d4dc25b15e41b543feda358e56b3bd927de355a5cf3b6b18/bands-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "01b0b6e347d4e0c545e87b5a92da8c2c", "sha256": "290dc477ed1359879767fd7d09acb53002f1fe80c89a7f5e888dc26f96f45e03" }, "downloads": -1, "filename": "bands-0.1.1.tar.gz", "has_sig": false, "md5_digest": "01b0b6e347d4e0c545e87b5a92da8c2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6464, "upload_time": "2018-04-23T21:33:28", "url": "https://files.pythonhosted.org/packages/9f/10/1252c4a545eb3afaaac4fa73b116a3360e3fe9c77d2aff2974bc822aace5/bands-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "27ae819f97964349322f63b26cd18521", "sha256": "6e8126d3a83c600da42f0d46fcab87fbfe9f0bb0f6912559012ef310b95e9f4e" }, "downloads": -1, "filename": "bands-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "27ae819f97964349322f63b26cd18521", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6450, "upload_time": "2018-06-11T17:10:32", "url": "https://files.pythonhosted.org/packages/f7/1c/1aa544188b14f180a54f1c74de468f16e04b9711e86b8475b0c848e9ac53/bands-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "26adc4f65834e6036f59a8902ac3d822", "sha256": "8a160b99604b33d9bfee05075d33f839409ceed6ece83e7ed41b9501469efda3" }, "downloads": -1, "filename": "bands-0.1.2.tar.gz", "has_sig": false, "md5_digest": "26adc4f65834e6036f59a8902ac3d822", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6400, "upload_time": "2018-06-11T17:10:33", "url": "https://files.pythonhosted.org/packages/1a/df/adecc82cd214c20693e57dccec3339605bb4487b2a0d2cf5fbcab86bcca6/bands-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "752e0ccafe06589590dec06ff265dd75", "sha256": "8465f821da9857449dccd26ea22be355501090d8609c05c51400902eccb09366" }, "downloads": -1, "filename": "bands-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "752e0ccafe06589590dec06ff265dd75", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6521, "upload_time": "2018-06-14T21:45:37", "url": "https://files.pythonhosted.org/packages/72/dc/00dce556d1cda148b8e1ba05b57ec59b80fd33a28e20f24a1dab44f78c7e/bands-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a848036e99834c390782453d9787edf", "sha256": "920ad0a486ee30db11fda18a41a91307873db39f0d2c80fdc309641b458c4340" }, "downloads": -1, "filename": "bands-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5a848036e99834c390782453d9787edf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6513, "upload_time": "2018-06-14T21:45:38", "url": "https://files.pythonhosted.org/packages/66/23/06a114c86d21cb3794f134c6fa62561d66599642c883fc7cd06d8b121020/bands-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "752e0ccafe06589590dec06ff265dd75", "sha256": "8465f821da9857449dccd26ea22be355501090d8609c05c51400902eccb09366" }, "downloads": -1, "filename": "bands-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "752e0ccafe06589590dec06ff265dd75", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6521, "upload_time": "2018-06-14T21:45:37", "url": "https://files.pythonhosted.org/packages/72/dc/00dce556d1cda148b8e1ba05b57ec59b80fd33a28e20f24a1dab44f78c7e/bands-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a848036e99834c390782453d9787edf", "sha256": "920ad0a486ee30db11fda18a41a91307873db39f0d2c80fdc309641b458c4340" }, "downloads": -1, "filename": "bands-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5a848036e99834c390782453d9787edf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6513, "upload_time": "2018-06-14T21:45:38", "url": "https://files.pythonhosted.org/packages/66/23/06a114c86d21cb3794f134c6fa62561d66599642c883fc7cd06d8b121020/bands-0.1.3.tar.gz" } ] }