{ "info": { "author": "Agroptima S.L.", "author_email": "developers@agroptima.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Utilities" ], "description": "# Domain Events\n\n[![Build Status](https://travis-ci.org/agroptima/domain-events.svg)](https://travis-ci.org/agroptima/domain-events)\n[![License GPLv3](https://img.shields.io/badge/license-GPLv3-red.svg)](https://opensource.org/licenses/GPL-3.0)\n![Python versions](https://img.shields.io/badge/python-3.x-blue.svg)\n\nA lightweight library with an implementation of Pub-Sub.\n\n## Install\n\n```\n$ pipenv install domain-events\n```\n\nor\n\n```\n$ pip install domain-events\n```\n\n## Usage\n\n\nIn order to have the pub-sub working in your application, you'll need to write your own subscribers and to subscribe them to the publisher.\n\n`domain-events` provides an interface for subscribers that needs to be implemented by your own subscribers in the first place. Two methods are mandatory: `handle(self, event)` and `_events_subscribed_to(self)`. Following is an example of how to do it.\n\n```python\n\nfrom domain_events import Subscriber\n\n\nclass ExampleSubscriber(Subscriber):\n\n def handle(self, event):\n # Logic to handle the occurring event\n\n def _events_subscribed_to(self):\n \"\"\" Return the tuple of events it is subscribed to. \"\"\"\n\n return (AnEvent, AnotherEvent)\n```\n\nOnce the subscriber is implemented, you'll need to subscribe it to the event publisher.\n\n```python\n\nfrom domain_events import Publisher\n\nPublisher().subscribe(ExampleSubscriber())\n```\n\nNow, in order to publish an event, just call the `publish` method on the `Publisher` with one of your domain events.\n\n```python\nfrom domain_events import Event, Publisher\n\n\nclass AnEvent(Event):\n pass\n\nPublisher().publish(AnEvent())\n```\n\nThe event will be passed on to the proper subscribers.\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/agroptima/domain-events/releases", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/agroptima/domain-events", "keywords": "python", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "domain-events", "package_url": "https://pypi.org/project/domain-events/", "platform": "", "project_url": "https://pypi.org/project/domain-events/", "project_urls": { "Download": "https://github.com/agroptima/domain-events/releases", "Homepage": "https://github.com/agroptima/domain-events" }, "release_url": "https://pypi.org/project/domain-events/2.0/", "requires_dist": null, "requires_python": "", "summary": "A lightweight library with an implementation of Pub-Sub.", "version": "2.0" }, "last_serial": 5154770, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "b8d9b5e897930d46f5a83dda36a8d68b", "sha256": "50c4a15ee0465ccb5af9ac13a96141db399e8b8cf35763e170315f0e17ed0fd8" }, "downloads": -1, "filename": "domain_events-1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "b8d9b5e897930d46f5a83dda36a8d68b", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3520, "upload_time": "2018-07-20T08:07:05", "url": "https://files.pythonhosted.org/packages/e8/34/51186434de1ecbcbb949d8845b0bcb922bd73964ba5d288e67f70b411304/domain_events-1.0-py2-none-any.whl" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "876027ea0717de3367094c6947749c25", "sha256": "e4e5468d073e197563da174712f25e76ae51c014a8d0919b68b422acae3a08f9" }, "downloads": -1, "filename": "domain_events-1.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "876027ea0717de3367094c6947749c25", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3537, "upload_time": "2018-07-20T08:19:11", "url": "https://files.pythonhosted.org/packages/a0/73/7b939202e93d97bd74cfa2742196abacb15d8e8b9933846db9d7eecca9de/domain_events-1.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2d0f25462d98820ded35823f187d6bcb", "sha256": "a4b582d2deb72c1b2fd9f3b11f1a584d046662f32a52e144bb73bef892ea5176" }, "downloads": -1, "filename": "domain-events-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2d0f25462d98820ded35823f187d6bcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2649, "upload_time": "2018-07-20T08:19:12", "url": "https://files.pythonhosted.org/packages/2e/3c/a1f80e99e2205b82fea13207232e3fabfb7f8c47ce0e58410284badcaea1/domain-events-1.0.1.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "054c7889bbd772d20168769b7dc26d07", "sha256": "83a6f1d491e541364d8c739c5aec9159aa8efa4a664977719a217866cda349c6" }, "downloads": -1, "filename": "domain_events-2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "054c7889bbd772d20168769b7dc26d07", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 15937, "upload_time": "2019-04-17T11:30:28", "url": "https://files.pythonhosted.org/packages/f7/5b/66a225721a795664df76eee085db4066d86a618a0c2f33d705b9a91316ae/domain_events-2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f05afcd2add140d417968a6c0cb274f9", "sha256": "0858fd2d13b4c8fe4d5902bb2eaf0377dfa9e3e3b3e0b57b7283a7360407f091" }, "downloads": -1, "filename": "domain-events-2.0.tar.gz", "has_sig": false, "md5_digest": "f05afcd2add140d417968a6c0cb274f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2822, "upload_time": "2019-04-17T11:30:42", "url": "https://files.pythonhosted.org/packages/ee/72/d47b0d054a43340e1035716c4407f212656e60042cef5c74c6d3a9ad19a7/domain-events-2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "054c7889bbd772d20168769b7dc26d07", "sha256": "83a6f1d491e541364d8c739c5aec9159aa8efa4a664977719a217866cda349c6" }, "downloads": -1, "filename": "domain_events-2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "054c7889bbd772d20168769b7dc26d07", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 15937, "upload_time": "2019-04-17T11:30:28", "url": "https://files.pythonhosted.org/packages/f7/5b/66a225721a795664df76eee085db4066d86a618a0c2f33d705b9a91316ae/domain_events-2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f05afcd2add140d417968a6c0cb274f9", "sha256": "0858fd2d13b4c8fe4d5902bb2eaf0377dfa9e3e3b3e0b57b7283a7360407f091" }, "downloads": -1, "filename": "domain-events-2.0.tar.gz", "has_sig": false, "md5_digest": "f05afcd2add140d417968a6c0cb274f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2822, "upload_time": "2019-04-17T11:30:42", "url": "https://files.pythonhosted.org/packages/ee/72/d47b0d054a43340e1035716c4407f212656e60042cef5c74c6d3a9ad19a7/domain-events-2.0.tar.gz" } ] }