{ "info": { "author": "Jordi Masip", "author_email": "jordi@masip.cat", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# aioerl\n\n[![PyPI version](https://badge.fury.io/py/aioerl.svg)](https://badge.fury.io/py/aioerl)\n\n`aioerl` is a python library that mimics the philosophy of Erlang's processes with asyncio tasks.\n\nImplements the following ideas:\n\n- **Each process has a mailbox**: a queue to receive messages from other processes.\n- **Message passing**: processes communicate entirely with messages (from the point of view of the developer)\n- **Supervisor/monitors**: processes can monitor other processes (when a process dies or crashes, sends a message to its supervisor with the exit reason or the exception)\n\n## Why?\n\n`asyncio` is awesome and built-in structures like `asyncio.Queue` are great for communicating between tasks but is hard to manage errors.\n\nWith `aioerl`, a process just waits for incoming messages from other processes and decides what to do for each event (see [example](##example)).\n\n## Quickstart\n\nRequirements: Python 3.7+\n\nInstallation:\n\n```bash\npip install aioerl\n```\n\n## Example\n\n```python\nfrom aioerl import spawn_monitored, receive, reply, send, run\n\nasync def ping_pong():\n while True:\n m = await receive(timeout=10)\n if m.is_ok:\n if m.body == \"ping\":\n await reply(\"pong\")\n else:\n raise Exception(\"Invalid message body\")\n elif m.is_timeout:\n return # terminate process\n\n\nasync def main():\n p = await spawn_monitored(ping_pong())\n\n await send(p, \"ping\")\n print(await receive()) # Message(sender=, event='ok', body='pong')\n\n await send(p, \"pang\")\n print(await receive()) # Message(sender=, event='err', body=Exception(\"Invalid message body\"))\n\n await send(p, \"ping\")\n print(await receive()) # Message(sender=, event='exit', body='noproc')\n\n\nif __name__ == \"__main__\":\n run(main())\n```\n\n## TODO:\n\nLot of things!", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/masipcat/aioerl", "keywords": "", "license": "GNU license", "maintainer": "", "maintainer_email": "", "name": "aioerl", "package_url": "https://pypi.org/project/aioerl/", "platform": "", "project_url": "https://pypi.org/project/aioerl/", "project_urls": { "Homepage": "https://github.com/masipcat/aioerl" }, "release_url": "https://pypi.org/project/aioerl/0.0.20190425.3/", "requires_dist": null, "requires_python": "", "summary": "", "version": "0.0.20190425.3" }, "last_serial": 5188994, "releases": { "0.0.20190425": [ { "comment_text": "", "digests": { "md5": "138ba96ca91b3acf303975f3525b22c1", "sha256": "c14d4adca3e6738b2f5d95ee0beb1efe802082b0b1897a3cf420bc3d76a66b3c" }, "downloads": -1, "filename": "aioerl-0.0.20190425.tar.gz", "has_sig": false, "md5_digest": "138ba96ca91b3acf303975f3525b22c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3853, "upload_time": "2019-04-24T23:15:01", "url": "https://files.pythonhosted.org/packages/c8/c9/5e3ef9a302f65b97587527d02c9e8554e5b52be18387569e0b7ddb1756f3/aioerl-0.0.20190425.tar.gz" } ], "0.0.20190425.1": [ { "comment_text": "", "digests": { "md5": "9e15f815cbe1fcb71d764545e82d747e", "sha256": "eb342401cb4da382f7aea25cb9c3992c4185edd94209f9e3643a49ae2fafcc46" }, "downloads": -1, "filename": "aioerl-0.0.20190425.1.tar.gz", "has_sig": false, "md5_digest": "9e15f815cbe1fcb71d764545e82d747e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15925, "upload_time": "2019-04-24T23:30:21", "url": "https://files.pythonhosted.org/packages/16/95/f020cf28f4d271bdad21f07b1261a79ef641ccd4fd74872d4f8a2f1d4fdd/aioerl-0.0.20190425.1.tar.gz" } ], "0.0.20190425.2": [ { "comment_text": "", "digests": { "md5": "6b6ec016dec4c2e9fc7bd5c272314546", "sha256": "a1f3f1f3e058d289ad8a4b04d9b17be87885a0862dc63b470e867b78c054e00b" }, "downloads": -1, "filename": "aioerl-0.0.20190425.2.tar.gz", "has_sig": false, "md5_digest": "6b6ec016dec4c2e9fc7bd5c272314546", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16717, "upload_time": "2019-04-25T08:43:53", "url": "https://files.pythonhosted.org/packages/2d/8d/9c77f7a62bf545e4d7b69f77466ff8ddb0c0eb25f37127d49422f05b8db3/aioerl-0.0.20190425.2.tar.gz" } ], "0.0.20190425.3": [ { "comment_text": "", "digests": { "md5": "0514646e4b16c18f5c04dba16ce24995", "sha256": "663acdf4e1820431bfd0f6eb9b324ed03abc29134c156d891ce1b713a4a637b8" }, "downloads": -1, "filename": "aioerl-0.0.20190425.3.tar.gz", "has_sig": false, "md5_digest": "0514646e4b16c18f5c04dba16ce24995", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16939, "upload_time": "2019-04-25T16:53:07", "url": "https://files.pythonhosted.org/packages/ed/ec/1c9c31a5abcb3c0b8acfa791772f152ea5557db65be179b87d8f6e28790b/aioerl-0.0.20190425.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0514646e4b16c18f5c04dba16ce24995", "sha256": "663acdf4e1820431bfd0f6eb9b324ed03abc29134c156d891ce1b713a4a637b8" }, "downloads": -1, "filename": "aioerl-0.0.20190425.3.tar.gz", "has_sig": false, "md5_digest": "0514646e4b16c18f5c04dba16ce24995", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16939, "upload_time": "2019-04-25T16:53:07", "url": "https://files.pythonhosted.org/packages/ed/ec/1c9c31a5abcb3c0b8acfa791772f152ea5557db65be179b87d8f6e28790b/aioerl-0.0.20190425.3.tar.gz" } ] }