{ "info": { "author": "Fatih K\u0131l\u0131\u00e7", "author_email": "m.fatihklc0@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ], "description": "# Serviceless Distributor\nThe Serviceless Distributor is a library to help you to run exact functions without any other service.\n\n## How it works?\nIt is simply a decorator which takes arguments and keyword arguments, pickles them and sends them to other nodes with **HTTP** requests.\n\n## Is it efficient to use?\nThe answer is depends on the mode you select. If you set `Distributor.bounce_mode = False` one node need to send data to all nodes **BUT** if you set `Distributor.bounce_mode = True` (which is default) all nodes will send data to next node so all nodes will make only one request instead of `len(SERVICELESS_DISTRIBUTOR_NODES)`.\n\n## Is it secure?\nIt is secure as you keep your **key** as a secret. Library uses `django.core.signing` replica([djangoless-signing](https://github.com/FKLC/djangoless-signing)) to sign and unsign data to make sure data is sent over servers. **BUT** it is always recommended to configure your servers to restrict IPs connecting to this endpoint.\n\n## Quick Start for Flask\n**USE THIS LIBRARY IF YOU AREN'T USING DJANGO** if you are using Django check [django-serviceless-distributor](https://github.com/FKLC/django-serviceless-distributor)\n\n\nInstall library\n```bash\npip install serviceless-distributor\n```\n\nAdd this snippet to your app\n```py\n....\nfrom serviceless_distributor import Distributor\n....\n\n....\n# Key to sign your data\nDistributor.key = b\"literally anything but you'll have to keep it secret\"\n\n# Nodes IPs (Do not use load balancer IP, we couldn't know\n# if all nodes affected if you use load balancer IP)\nDistributor.nodes = [\"http://10.0.0.0\", \"http://10.0.0.1\"]\n\n# Headers to use while sending data\n# (This can be used to change \"Host\" to pass Host restriction)\nDistributor.headers = {}\n....\n\n@app.route(\"/serviceless_distributor\", methods=['POST'])\ndef hello():\n data = request.form.get('username')\n if data:\n Distributor._run_function(data)\n return \"\"\n```\n\nRegister functions you want to distributed\n```py\nfrom serviceless_distributor import Distributor\n\n@Distributor.register_function()\ndef sum_arguments(*args):\n return sum(args)\n\n# Or lets suppose you want to distribute an imported function\nfrom some_module import some_function\n\nsome_function = Distributor.register_function()(some_function)\n```\n\n\n### (Not) Frequently Asked Questions\n1. How do I set different node set for diffrent functions?\n ```py\n special_nodes = [\"http://10.0.0.0\", \"http://10.0.0.1\"]\n\n @Distributor.register_function(nodes=special_nodes)\n def sum_arguments(*args):\n return sum(args)\n\n # Or\n from some_module import some_function\n\n Distributor.register_function(nodes=special_nodes)(some_function)\n ```\n\n2. Can I change the path?\n\n Yes, you can change `Distributor.path` **BUT** also don't forget to change your url config according to the change you made.\n\n3. How many requests sent by library simultaneously?\n\n It is 10 by default but you can change by setting `Distributor.simultaneous_requests`. **ATTENTION** by simultaneously requests it means distributing registered functions to other nodes. If you run a registered function X times in a row server will send X times of requests. It doesn't create X threads for every registered function run.\n\n4. Is it blocking?\n\n **No**, it creates threads using `concurrent.futures.ThreadPoolExecutor` and returns the output of registered function.\n\n5. Why should I use this instead of other libraries?\n\n The only reason could be saving money this is actually why I created that. To me this isn't a good solution when compared to other libraries but the best at least I can do without any other servers.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://pypi.org/project/serviceless-distributor/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/FKLC/serviceless-distributor", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "serviceless-distributor", "package_url": "https://pypi.org/project/serviceless-distributor/", "platform": "", "project_url": "https://pypi.org/project/serviceless-distributor/", "project_urls": { "Download": "https://pypi.org/project/serviceless-distributor/", "Homepage": "https://github.com/FKLC/serviceless-distributor" }, "release_url": "https://pypi.org/project/serviceless-distributor/1.0.101/", "requires_dist": [ "requests", "djangoless-signing" ], "requires_python": "", "summary": "A simple library to run exact functions over all server nodes without any service", "version": "1.0.101" }, "last_serial": 5008744, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "56ce4e9be02296719dca7fec15f8fc82", "sha256": "e95bde83c36e77080c0aa92d62c753a238444aaab2c87c774823e317cc103e4e" }, "downloads": -1, "filename": "serviceless_distributor-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "56ce4e9be02296719dca7fec15f8fc82", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5734, "upload_time": "2019-03-30T18:53:50", "url": "https://files.pythonhosted.org/packages/3f/86/69fc4aa2e1e75e4ebeff1b3dd2ab3f128b70c9d935fc09a664e7463218fe/serviceless_distributor-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "abbe06f6e7e79d773b8db5230230fc3f", "sha256": "4ce8847bc60e8ad252e1a7c8e04ebcbe72527e25445e936d47d97ec3fddcd339" }, "downloads": -1, "filename": "serviceless-distributor-1.0.0.tar.gz", "has_sig": false, "md5_digest": "abbe06f6e7e79d773b8db5230230fc3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4616, "upload_time": "2019-03-30T18:53:52", "url": "https://files.pythonhosted.org/packages/2c/34/00408cf3e5302762d77459dc78ab5973f66c79ba87c16e699c95e15cf3dc/serviceless-distributor-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "00de60d36870707b76641abebd4b2939", "sha256": "6481295ba3979fbce07eba8823d27824e780fbb402517fa9c05ddd94e2bbdbae" }, "downloads": -1, "filename": "serviceless_distributor-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "00de60d36870707b76641abebd4b2939", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5746, "upload_time": "2019-03-30T20:41:21", "url": "https://files.pythonhosted.org/packages/56/ef/92a435cac5df68744dc3c3f79198e03782e350edfbe19b8a4b495e6d015f/serviceless_distributor-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b88ba4e8e5f4bbcda25148a9aa9155bd", "sha256": "18c02ea6f1716afb475c3b7e31584199fa4e8f9df32bb06dade54d364e05ebcd" }, "downloads": -1, "filename": "serviceless-distributor-1.0.1.tar.gz", "has_sig": false, "md5_digest": "b88ba4e8e5f4bbcda25148a9aa9155bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4625, "upload_time": "2019-03-30T20:41:23", "url": "https://files.pythonhosted.org/packages/d7/f4/9624ff58d5287dc83c88ad5998cf34e86207817fffe692e4311602f66581/serviceless-distributor-1.0.1.tar.gz" } ], "1.0.101": [ { "comment_text": "", "digests": { "md5": "15beccc2b9c3e333c786bc844172fcca", "sha256": "37f8f4d4d43384e07e6d9ec42920b9b4ebf351f7ba542a1c503c8ec7053f9cd9" }, "downloads": -1, "filename": "serviceless_distributor-1.0.101-py3-none-any.whl", "has_sig": false, "md5_digest": "15beccc2b9c3e333c786bc844172fcca", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5774, "upload_time": "2019-03-31T06:54:01", "url": "https://files.pythonhosted.org/packages/6e/f9/55c863432633c2f74d97d31afcd37263e1f4db06345e1d730ea6fdb70090/serviceless_distributor-1.0.101-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "edc69cedf0f6fcbbb6d43fe005400421", "sha256": "1a4e44201899c6c590ae0a972e716391ca86edbbc3a2cb7f7b0e2d41e3aa1c08" }, "downloads": -1, "filename": "serviceless-distributor-1.0.101.tar.gz", "has_sig": false, "md5_digest": "edc69cedf0f6fcbbb6d43fe005400421", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4638, "upload_time": "2019-03-31T06:54:03", "url": "https://files.pythonhosted.org/packages/10/81/e11186b0b66bb8174b68bfd6c548fd8629a95e5542312613dfdd6d800b07/serviceless-distributor-1.0.101.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "15beccc2b9c3e333c786bc844172fcca", "sha256": "37f8f4d4d43384e07e6d9ec42920b9b4ebf351f7ba542a1c503c8ec7053f9cd9" }, "downloads": -1, "filename": "serviceless_distributor-1.0.101-py3-none-any.whl", "has_sig": false, "md5_digest": "15beccc2b9c3e333c786bc844172fcca", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5774, "upload_time": "2019-03-31T06:54:01", "url": "https://files.pythonhosted.org/packages/6e/f9/55c863432633c2f74d97d31afcd37263e1f4db06345e1d730ea6fdb70090/serviceless_distributor-1.0.101-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "edc69cedf0f6fcbbb6d43fe005400421", "sha256": "1a4e44201899c6c590ae0a972e716391ca86edbbc3a2cb7f7b0e2d41e3aa1c08" }, "downloads": -1, "filename": "serviceless-distributor-1.0.101.tar.gz", "has_sig": false, "md5_digest": "edc69cedf0f6fcbbb6d43fe005400421", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4638, "upload_time": "2019-03-31T06:54:03", "url": "https://files.pythonhosted.org/packages/10/81/e11186b0b66bb8174b68bfd6c548fd8629a95e5542312613dfdd6d800b07/serviceless-distributor-1.0.101.tar.gz" } ] }