{ "info": { "author": "arsh23", "author_email": "programmer.arsh@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development" ], "description": "#############\nAsynchronizer\n#############\n\n.. _description:\n\n**Asynchronizer** is simple module that can be used to run multiple functions asynchronously. To convert a function, you just need to add a decorator :code:`@asynchronize` to the function. This project is still in development, so report any bugs `here `_. For examples, see the `examples folder `_\n\n.. contents::\n\n.. _requirements:\n\nRequirements\n************\n\n- python 2.x **or** python 3.x\n\n\n.. _installation:\n\nInstallation\n************\n\n**Asynchronizer** can be installed using pip:\n\n.. code-block:: bash\n\n pip install asynchronizer\n\nHow to use\n**********\nBasic use\n^^^^^^^^^\n\nSuppose you have a function like this:\n\n.. code-block:: python\n\n import requests\n\n def send_requests():\n r = requests.get('http://httpbin.org/get')\n print r.status_code\n\n for _ in range(20):\n send_requests()\n\nYou can modify it like this to make it asynchronous:\n\n.. code-block:: python\n\n import requests\n from asynchronizer import asynchronize, Wait\n\n @asynchronize\n def send_requests():\n r = requests.get('http://httpbin.org/get')\n print r.status_code\n\n for _ in range(20):\n send_requests()\n\n Wait()\n\nExample Script:\n^^^^^^^^^^^^^^^\n\nThis example script will take 55 seconds to run normally, but only 10 seconds when run asynchronously\n\n.. code-block:: python\n\n import time\n from asynchronizer import asynchronize, Wait, setWorkers\n\n @asynchronize\n def func(i):\n time.sleep(i)\n print i\n\n for i in range(1,11):\n func(i)\n\n Wait()\n\n\nThings to keep in mind\n^^^^^^^^^^^^^^^^^^^^^^\n\n- The function :code:`Wait()` is necessary. If :code:`Wait()` is not present, your script will end without waiting for any unfinished functions to finish.\n\n- The function :code:`Wait()` is also a blocking function, meaning that the execution of your script will pause here till all the async functions called before this are finished. This is why it should usually be added at the end of your script\n\n- The decorated functions are async to each other, but the code inside the functions is synchronous, which means this is wrong:\n\n .. code-block:: python\n\n # wrong way\n @asynchronize\n def send_requests():\n for _ in range(20):\n r = requests.get('http://httpbin.org/get')\n\n send_requests()\n\n and this is the correct way:\n\n .. code-block:: python\n\n # correct way\n @asynchronize\n def send_requests():\n r = requests.get('http://httpbin.org/get')\n\n for _ in range(20):\n send_requests()\n\n- Instead of returning values from your functions, send them to a callback. For example:\n\n .. code-block:: python\n\n @asynchronize\n def send_requests():\n r = requests.get('http://httpbin.org/get')\n parse(r.text)\n # instead of return r.text\n\nAdvanced use\n^^^^^^^^^^^^\n\n- If you want to use a custom number of workers, just add :code:`setWorkers(n)` at the start of your script, with :code:`n` being the number of concurrent greenlet threads you want. Default is 32.\n\n- To assign priority to a specific function call, add :code:`priority=n` to the parameters of the function call, with :code:`n` being the priority you want to set. For Example: :code:`func(param1,param2,param3,priority=2)`\n\nContributing\n************\n\nIf you want to contribute to this project, feel free to send a Pull Request to `Github `_\n\nTo report any bugs or request new features, head over to the `Issues `_ page\n\nLicense\n*******\n\nLicensed under `The MIT License (MIT) `_.\n\n\nCopyright\n*********\n\nCopyright (c) 2016 Arsh\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/Arsh23/asynchronizer/tarball/0.2.4", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Arsh23/asynchronizer", "keywords": "async asynchronous gevent", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "asynchronizer", "package_url": "https://pypi.org/project/asynchronizer/", "platform": "", "project_url": "https://pypi.org/project/asynchronizer/", "project_urls": { "Download": "https://github.com/Arsh23/asynchronizer/tarball/0.2.4", "Homepage": "https://github.com/Arsh23/asynchronizer" }, "release_url": "https://pypi.org/project/asynchronizer/0.2.4/", "requires_dist": null, "requires_python": "", "summary": "A simple module to make functions asynchronous", "version": "0.2.4" }, "last_serial": 2287753, "releases": { "0.1.0a1": [ { "comment_text": "", "digests": { "md5": "78386b9294fa9fc2b04d631f24d6665e", "sha256": "a144a837694145d3b43060af871df34bb800ab02688d0119f6be4327352da860" }, "downloads": -1, "filename": "asynchronizer-0.1.0a1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "78386b9294fa9fc2b04d631f24d6665e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5430, "upload_time": "2016-07-19T13:20:29", "url": "https://files.pythonhosted.org/packages/92/25/48b5dca77f116358be218a7e72c532fcb21640fd25b7dc7c31adde9da068/asynchronizer-0.1.0a1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8e45968af93f0caa8a6d3a33b929f6f4", "sha256": "8ae238a02d69203530ea990a15a16e465181e7b193b5536af9e8dc749468ca20" }, "downloads": -1, "filename": "asynchronizer-0.1.0a1.tar.gz", "has_sig": false, "md5_digest": "8e45968af93f0caa8a6d3a33b929f6f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3305, "upload_time": "2016-07-19T13:20:31", "url": "https://files.pythonhosted.org/packages/4c/ff/9f6b473a34562143d271815784b4ec20487ed7d82c7d7885fa22cb2849ad/asynchronizer-0.1.0a1.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "5d6a807210c1f299ec9a5909958184b3", "sha256": "6ce2215bfc6c8c04deb13a9f5186e16434e2a022f6ffed361bc71f03b0af6fd0" }, "downloads": -1, "filename": "asynchronizer-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5d6a807210c1f299ec9a5909958184b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3515, "upload_time": "2016-07-25T15:45:08", "url": "https://files.pythonhosted.org/packages/1e/3f/562418c5e09bdfe187305521e148c2ed488aa20816118bd524f2135fe6c0/asynchronizer-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "a536924fc5384fb3c13995073ca67947", "sha256": "0b0d9a5f879539b676f41e8cf7890874d49627d7b0755737dabced33965342f6" }, "downloads": -1, "filename": "asynchronizer-0.2.2.tar.gz", "has_sig": false, "md5_digest": "a536924fc5384fb3c13995073ca67947", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3527, "upload_time": "2016-07-25T16:13:01", "url": "https://files.pythonhosted.org/packages/02/81/c61cf62fef28bb3f7262e1d13b83d74cd42212c1493b3363fd35d89da965/asynchronizer-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "18bd3437f1400e94adebd5309306c182", "sha256": "bc09575473863c1e71aaba6d7f3c061a3139b9f025669436c12e819e32d57f90" }, "downloads": -1, "filename": "asynchronizer-0.2.3.tar.gz", "has_sig": false, "md5_digest": "18bd3437f1400e94adebd5309306c182", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3694, "upload_time": "2016-07-25T16:14:50", "url": "https://files.pythonhosted.org/packages/c4/b4/bfcb19e64034ced36d2fb5b9fe4d22cf1bf4d7b973f4cb6e9e9a07759b20/asynchronizer-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "b0a0051a58a924f9ef06e640f3153677", "sha256": "928a51092e695a9b45cbebed06a7af2a67cdec0afb57556c83988a456d82fee8" }, "downloads": -1, "filename": "asynchronizer-0.2.4.tar.gz", "has_sig": false, "md5_digest": "b0a0051a58a924f9ef06e640f3153677", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3649, "upload_time": "2016-08-18T05:46:38", "url": "https://files.pythonhosted.org/packages/3e/dc/cf0cd9576b3b5e9f4b1976f1770574fd506d548d23b20399048e4d5e3288/asynchronizer-0.2.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b0a0051a58a924f9ef06e640f3153677", "sha256": "928a51092e695a9b45cbebed06a7af2a67cdec0afb57556c83988a456d82fee8" }, "downloads": -1, "filename": "asynchronizer-0.2.4.tar.gz", "has_sig": false, "md5_digest": "b0a0051a58a924f9ef06e640f3153677", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3649, "upload_time": "2016-08-18T05:46:38", "url": "https://files.pythonhosted.org/packages/3e/dc/cf0cd9576b3b5e9f4b1976f1770574fd506d548d23b20399048e4d5e3288/asynchronizer-0.2.4.tar.gz" } ] }