{ "info": { "author": "Kevin Conway", "author_email": "kevinjacobconway@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "=====\napyio\n=====\n\n*Async wrappers for standard Python io streams.*\n\nExample Usage\n=============\n\nFor simple use cases this package provides the same high level utilities as\nthe Python `io` module:\n\n.. code-block:: python\n\n import apyio\n\n string_buff = apyio.StringIO()\n bytes_buff = apyio.BytesIO()\n file_handle = apyio.open('somefile.txt', 'r')\n\nThe `write`, `writelines`, and `close` methods are left as normal functions\njust as they are for the asyncio streams. However, any function which might\nresult in a read operation, such as `read`, `readline`, `readlines`, `read1`,\n`seek`, `tell`, and `truncate`, are now `async def` functions that must be\n`await`ed.\n\n.. code-block:: python\n\n import apyio\n\n async with apyio.open('somefile.txt', 'w') as file_handle:\n\n file_handle.write('some data')\n await file_handle.drain() # Same as flush().\n\n async with apyio.open('somefile.txt', 'r') as file_handle:\n\n data = await file_handle.read()\n print(data)\n\n file_handle = apyio.open('somefile.txt', 'r')\n async for line in file_handle:\n\n print(line)\n\nFor more advanced use cases, this package also contains async wrappers for all\nclasses defined in the Python `io` module. The wrappers are named using the\npattern `Async<>Wrapper`. For example, `BufferedReader` becomes\n`AsyncBufferedReaderWrapper` and `FileIO` becomes `AsyncFileIOWrapper`. All\nwrapper classes accept one argument in the constructor which must be the\noriginal, synchronous stream.\n\n.. code-block:: python\n\n import io\n import apyio\n\n sync_stream = io.FileIO('somefile.txt', 'r')\n async_stream = apyio.AsyncFileIOWrapper(sync_stream)\n print(sync_stream.readline())\n print((await async_stream.readline()))\n\nIf a file was opened using the built-in `open()` function it may not be an\ninstance of `io.FileIO`. Depending on the options given to `open()` different\nkinds of streams may be returned. To help with wrapping arbitrary `open()`\nreturn values use the `apyio.wrap_file()` helper.\n\n.. code-block:: python\n\n import apyio\n file_handle = open('somefile.bin', 'r+b')\n async_handle = apyio.wrap_file(file_handle)\n\nTesting\n=======\n\nAll tests are stored in the '/tests' subdirectory. All tests are expected to\npass for Python 3.5 and above. To run tests create a virtualenv and install\nthe test-requirements.txt list. After that using the `tox` command will launch\nthe test suite.\n\nLicense\n=======\n\n Copyright 2015 Kevin Conway\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\nContributing\n============\n\nFirstly, if you're putting in a patch then thank you! Here are some tips for\ngetting your patch merged:\n\nStyle\n-----\n\nAs long as the code passes the PEP8 and PyFlakes gates then the style is\nacceptable.\n\nDocs\n----\n\nThe PEP257 gate will check that all public methods have docstrings. If you're\nadding additional wrappers from the `io` module try to preserve the original\ndocstrings if possible. If you're adding something new, like a helper function,\ntry out the\n`napoleon style of docstrings `_.\n\nTests\n-----\n\nMake sure the patch passes all the tests. If you're adding a new feature don't\nforget to throw in a test or two. If you're fixing a bug then definitely add\nat least one test to prevent regressions.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/asyncdef/apyio", "keywords": null, "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "apyio", "package_url": "https://pypi.org/project/apyio/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/apyio/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/asyncdef/apyio" }, "release_url": "https://pypi.org/project/apyio/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Async wrappers for standard Python io streams.", "version": "0.2.0" }, "last_serial": 1773477, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6c5ddb0a3052fa02afa8124a75022518", "sha256": "bc5f5e61c57f75ea732bc3761bde6365ba7e7b7897c20ccca64f48d4a4139ba1" }, "downloads": -1, "filename": "apyio-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6c5ddb0a3052fa02afa8124a75022518", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14437, "upload_time": "2015-10-17T00:32:25", "url": "https://files.pythonhosted.org/packages/59/bb/013bffe3f7725c0eef618e60641171439e9e9f658210204d4cbd659ee2ed/apyio-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "255f6c3eff6d24e6c8b8a757423f9fa9", "sha256": "5d6a7eb6924bdcc8add00a5bd262f0ab8ab0bd0242e1b2564a85c1c0251ad981" }, "downloads": -1, "filename": "apyio-0.2.0.tar.gz", "has_sig": false, "md5_digest": "255f6c3eff6d24e6c8b8a757423f9fa9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14442, "upload_time": "2015-10-18T01:48:55", "url": "https://files.pythonhosted.org/packages/35/34/a354db74c0ff63c9398a3c15a59cfcbfc1c8ef97b63e505ed6b3f0b335e5/apyio-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "255f6c3eff6d24e6c8b8a757423f9fa9", "sha256": "5d6a7eb6924bdcc8add00a5bd262f0ab8ab0bd0242e1b2564a85c1c0251ad981" }, "downloads": -1, "filename": "apyio-0.2.0.tar.gz", "has_sig": false, "md5_digest": "255f6c3eff6d24e6c8b8a757423f9fa9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14442, "upload_time": "2015-10-18T01:48:55", "url": "https://files.pythonhosted.org/packages/35/34/a354db74c0ff63c9398a3c15a59cfcbfc1c8ef97b63e505ed6b3f0b335e5/apyio-0.2.0.tar.gz" } ] }