{ "info": { "author": "rhoboro", "author_email": "rhoboro@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# asynconsumer\n\nasynconsumer is a simple library for processing each items within iterable using asyncio.\n\n## How to install\n\n```sh\n$ pip3 install asynconsumer\n```\n\n## Quick start\n\n1. Define a function or a coroutine function which takes one argument.\n2. Now, call `async_run(iterable, function)` and you can get list which each items was applied with the function. \n`concurrency` is an optional parameter can changes number of concurrently executed coroutines(default: 1).\n\n\n### Examples\n\n`coro` in the following code is a coroutine function that convert a word passed as an argument to an upper case. \nSo, `async_run(['ham', 'egg', 'spam'], coro, concurrency=2)` will return `['HAM', 'EGG', 'SPAM']`.\n\n```python\n>>> from asynconsumer.core import async_run\n>>> import asyncio\n>>> async def coro(target):\n... print('start: {}'.format(target))\n... await asyncio.sleep(1)\n... print('end: {}'.format(target))\n... return target.upper()\n...\n>>> results = async_run(['ham', 'egg', 'spam'], coro, concurrency=2)\nstart: ham\nstart: egg\nend: ham\nend: egg\nstart: spam\nend: spam\n>>> results\n['HAM', 'EGG', 'SPAM']\n>>>\n```\n\nYou can also pass the normal functions.\n\n```python\n>>> from asynconsumer.core import async_run\n>>> import time\n>>> def func(target):\n... print('start: {}'.format(target))\n... time.sleep(1)\n... print('end: {}'.format(target))\n... return target.upper()\n...\n>>> results = async_run(['ham', 'egg', 'spam'], func, concurrency=2)\nstart: ham\nstart: egg\nend: ham\nend: egg\nstart: spam\nend: spam\n>>> results\n['HAM', 'EGG', 'SPAM']\n>>>\n```\n\n## More samples.\n\nSample codes are put in [asynconsumer/samples](./asynconsumer/samples).\n\n### [Concurrent get HTTP resources](./asynconsumer/samples/http_downloader.py)\n\n```python\n$ pip3 install aiohttp\n$ python3 -q\n>>> from asynconsumer import fetch_http_resources\n>>> urls = ['https://avatars3.githubusercontent.com/u/13819005?s=460&v=4']\n>>> fetch_http_resources(urls, '.')\n['./8ee20d7c992fee4ac009f4d33c13e276']\n>>>\n>>> fetch_http_resources(urls=urls, directory='.', naming=lambda url: 'image_{}.jpg'.format(urls.index(url)))\n['./image_0.jpg']\n```\n\n### [Concurrent get GCS objects](./asynconsumer/samples/gcs_downloader.py)\n\n```python\n$ pip3 install google-cloud-storage\n$ python3 -q\n>>> from asynconsumer import fetch_gcs_objects\n>>> uris = ['gs://...']\n>>> fetch_gcs_objects(uris, '.')\n['./md5string']\n>>>\n>>> fetch_http_resources(uris, '.', naming=lambda uri: 'image_{}.jpg'.format(uris.index(uri)))\n['./image_0.jpg']\n```\n\n\n\n", "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/rhoboro/asynconsumer", "keywords": "", "license": "Apache License 2.0", "maintainer": "rhoboro", "maintainer_email": "rhoboro@gmail.com", "name": "asynconsumer", "package_url": "https://pypi.org/project/asynconsumer/", "platform": "", "project_url": "https://pypi.org/project/asynconsumer/", "project_urls": { "Homepage": "https://github.com/rhoboro/asynconsumer" }, "release_url": "https://pypi.org/project/asynconsumer/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "asynconsumer is a simple library for processing each items within iterable using asyncio.", "version": "1.0.5" }, "last_serial": 4857283, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "927dc0978bf617f0f188e56d757b718c", "sha256": "7948389453803295756accd3858861d3011f5979d471e4ec1d52e1f18b1e582c" }, "downloads": -1, "filename": "asynconsumer-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "927dc0978bf617f0f188e56d757b718c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5238, "upload_time": "2018-07-14T09:17:22", "url": "https://files.pythonhosted.org/packages/8a/61/26587124ae76adc09fc6cadd1d02fad6ef6f044682ec662ca31284d3ab03/asynconsumer-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "067b99eeaa8bf588580911fd54ba643e", "sha256": "287285f30629751607d94efdc48c12dee81a9579b2321f2f6e813345697379ce" }, "downloads": -1, "filename": "asynconsumer-0.0.1.tar.gz", "has_sig": false, "md5_digest": "067b99eeaa8bf588580911fd54ba643e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3708, "upload_time": "2018-07-14T09:17:23", "url": "https://files.pythonhosted.org/packages/d0/56/b029ddb0d6941127e65f61dbed4c96a253ad1eff5eef51d9007d83f032d0/asynconsumer-0.0.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "92557a7fdb69cba1155d3ad9bfdc6e7b", "sha256": "713b27e7e8b588176214c946da2e2e909eda8b12b1256c2139a0c389659eb117" }, "downloads": -1, "filename": "asynconsumer-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "92557a7fdb69cba1155d3ad9bfdc6e7b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5270, "upload_time": "2018-07-14T09:29:26", "url": "https://files.pythonhosted.org/packages/3b/19/63d013d797015e5a9c268afe978fa3be7507fa42461636fc5588fbbf32c1/asynconsumer-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e773080f7bf6334a41e7d1e65b4d36fd", "sha256": "435119d4bb106bcaa6672ff4f00a46af74634da0e37ff5f73eb668c476ee0c3b" }, "downloads": -1, "filename": "asynconsumer-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e773080f7bf6334a41e7d1e65b4d36fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3780, "upload_time": "2018-07-14T09:29:28", "url": "https://files.pythonhosted.org/packages/6b/3d/73c110cfe8b64fd07e54b94f25d750417b7054321788026fcf20ccc9889f/asynconsumer-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "5c2403d34e56aa16f01d14626707cff0", "sha256": "50d569997224df62652de38e04bf70cc3a120130b2701f4782f2c8df36f65b4f" }, "downloads": -1, "filename": "asynconsumer-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5c2403d34e56aa16f01d14626707cff0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5274, "upload_time": "2018-07-17T01:15:32", "url": "https://files.pythonhosted.org/packages/5d/4a/66f546566a3713fb9e4c76edbceaf5d1857802d19e36db22bbb346b0c996/asynconsumer-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "172871b3f6a3ae0e3276e305d09e53ad", "sha256": "400d6e890065c46acb87d87331b336e34c4d8dfc98f1016b3b0178693e5dced1" }, "downloads": -1, "filename": "asynconsumer-1.0.1.tar.gz", "has_sig": false, "md5_digest": "172871b3f6a3ae0e3276e305d09e53ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3873, "upload_time": "2018-07-17T01:15:33", "url": "https://files.pythonhosted.org/packages/65/18/f3d43595d8d835fe35b7d178abd1dcc25d41770ee931bc075363b91d3c4b/asynconsumer-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "fa5a109d7d0c6a249676af5c17971c2d", "sha256": "683c26d65a58b7afced487a97b11e104c3e36b7490fab9e89ab056703818891d" }, "downloads": -1, "filename": "asynconsumer-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "fa5a109d7d0c6a249676af5c17971c2d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9553, "upload_time": "2019-02-21T12:37:07", "url": "https://files.pythonhosted.org/packages/5d/b0/1e5b461840b45d91712b681c3f4fa2c2983f27988f2609daf63c6f7f4742/asynconsumer-1.0.2-py3-none-any.whl" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "5a9487a75986f21d8a3e7320a3d82ff3", "sha256": "96d5a9798532efd8ee3401286f150aba30ea4fca8144ec012942904b4116006e" }, "downloads": -1, "filename": "asynconsumer-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "5a9487a75986f21d8a3e7320a3d82ff3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10468, "upload_time": "2019-02-23T05:39:07", "url": "https://files.pythonhosted.org/packages/6e/b2/e6ce47bdf4fa0f22658d2e61a86ff2762416af0e3fdbc61b6a2b967938e6/asynconsumer-1.0.3-py3-none-any.whl" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "94f0128130ff4588f4ead3dc5700efce", "sha256": "1495e369d705ac196b00f47729281199f596ff6664efe7c7173a6e703ee9b745" }, "downloads": -1, "filename": "asynconsumer-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "94f0128130ff4588f4ead3dc5700efce", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10471, "upload_time": "2019-02-23T05:41:31", "url": "https://files.pythonhosted.org/packages/d0/cb/2f2722b03458812553ea1abcaee29000190e5bf942acc0108bfcba65f25d/asynconsumer-1.0.4-py3-none-any.whl" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "e5d1fb9152961bd2a41bee37ef194310", "sha256": "fd21108c3fc00ed7b1275e372e5b690329ef82763449320728b39c68f1e062f5" }, "downloads": -1, "filename": "asynconsumer-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e5d1fb9152961bd2a41bee37ef194310", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10471, "upload_time": "2019-02-23T05:42:46", "url": "https://files.pythonhosted.org/packages/01/13/3d83935205a69fa31bad13cb69c90ae25213aaaba8224e4699a97dc5b32c/asynconsumer-1.0.5-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e5d1fb9152961bd2a41bee37ef194310", "sha256": "fd21108c3fc00ed7b1275e372e5b690329ef82763449320728b39c68f1e062f5" }, "downloads": -1, "filename": "asynconsumer-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e5d1fb9152961bd2a41bee37ef194310", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10471, "upload_time": "2019-02-23T05:42:46", "url": "https://files.pythonhosted.org/packages/01/13/3d83935205a69fa31bad13cb69c90ae25213aaaba8224e4699a97dc5b32c/asynconsumer-1.0.5-py3-none-any.whl" } ] }