{ "info": { "author": "Tin Tvrtkovic", "author_email": "tinchester@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: System :: Filesystems" ], "description": "aiofiles: file support for asyncio\n==================================\n\n.. image:: https://img.shields.io/pypi/v/aiofiles.svg\n :target: https://pypi.python.org/pypi/aiofiles\n\n.. image:: https://travis-ci.org/Tinche/aiofiles.svg?branch=master\n :target: https://travis-ci.org/Tinche/aiofiles\n\n.. image:: https://codecov.io/gh/Tinche/aiofiles/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/Tinche/aiofiles\n\n**aiofiles** is an Apache2 licensed library, written in Python, for handling local\ndisk files in asyncio applications.\n\nOrdinary local file IO is blocking, and cannot easily and portably made\nasynchronous. This means doing file IO may interfere with asyncio applications,\nwhich shouldn't block the executing thread. aiofiles helps with this by\nintroducing asynchronous versions of files that support delegating operations to\na separate thread pool.\n\n.. code-block:: python\n\n async with aiofiles.open('filename', mode='r') as f:\n contents = await f.read()\n print(contents)\n 'My file contents'\n\nAsynchronous iteration is also supported.\n\n.. code-block:: python\n\n async with aiofiles.open('filename') as f:\n async for line in f:\n ...\n\nFeatures\n--------\n\n- a file API very similar to Python's standard, blocking API\n- support for buffered and unbuffered binary files, and buffered text files\n- support for ``async``/``await`` (:PEP:`492`) constructs\n\n\nInstallation\n------------\n\nTo install aiofiles, simply:\n\n.. code-block:: bash\n\n $ pip install aiofiles\n\nUsage\n-----\n\nFiles are opened using the ``aiofiles.open()`` coroutine, which in addition to\nmirroring the builtin ``open`` accepts optional ``loop`` and ``executor``\narguments. If ``loop`` is absent, the default loop will be used, as per the\nset asyncio policy. If ``executor`` is not specified, the default event loop\nexecutor will be used.\n\nIn case of success, an asynchronous file object is returned with an\nAPI identical to an ordinary file, except the following methods are coroutines\nand delegate to an executor:\n\n* ``close``\n* ``flush``\n* ``isatty``\n* ``read``\n* ``readall``\n* ``read1``\n* ``readinto``\n* ``readline``\n* ``readlines``\n* ``seek``\n* ``seekable``\n* ``tell``\n* ``truncate``\n* ``writable``\n* ``write``\n* ``writelines``\n\nIn case of failure, one of the usual exceptions will be raised.\n\nThe ``aiofiles.os`` module contains executor-enabled coroutine versions of\nseveral useful ``os`` functions that deal with files:\n\n* ``stat``\n* ``sendfile``\n\nWriting tests for aiofiles\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nReal file IO can be mocked by patching ``aiofiles.threadpool.sync_open``\nas desired. The return type also needs to be registered with the\n``aiofiles.threadpool.wrap`` dispatcher:\n\n.. code-block:: python\n\n aiofiles.threadpool.wrap.register(mock.MagicMock)(\n lambda *args, **kwargs: threadpool.AsyncBufferedIOBase(*args, **kwargs))\n\n async def test_stuff():\n data = 'data'\n mock_file = mock.MagicMock()\n\n with mock.patch('aiofiles.threadpool.sync_open', return_value=mock_file) as mock_open:\n async with aiofiles.open('filename', 'w') as f:\n await f.write(data)\n\n mock_file.write.assert_called_once_with(data)\n\nHistory\n~~~~~~~\n\n0.4.0 (2018-08-11)\n``````````````````\n- Python 3.7 support.\n- Removed Python 3.3/3.4 support. If you use these versions, stick to aiofiles 0.3.x.\n\n0.3.2 (2017-09-23)\n``````````````````\n- The LICENSE is now included in the sdist.\n `#31 `_\n\n0.3.1 (2017-03-10)\n``````````````````\n\n- Introduced a changelog.\n- ``aiofiles.os.sendfile`` will now work if the standard ``os`` module contains a ``sendfile`` function.\n\nContributing\n~~~~~~~~~~~~\nContributions are very welcome. Tests can be run with ``tox``, please ensure\nthe coverage at least stays the same before you submit a pull request.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Tinche/aiofiles", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "aiofiles", "package_url": "https://pypi.org/project/aiofiles/", "platform": "", "project_url": "https://pypi.org/project/aiofiles/", "project_urls": { "Homepage": "https://github.com/Tinche/aiofiles" }, "release_url": "https://pypi.org/project/aiofiles/0.4.0/", "requires_dist": null, "requires_python": "", "summary": "File support for asyncio.", "version": "0.4.0" }, "last_serial": 4160078, "releases": { "0.2": [], "0.2.1": [ { "comment_text": "", "digests": { "md5": "4d1c68c35b1edc41faf1e28195275814", "sha256": "2bc9cb71a10967289031e3158ee43a527b689650d044f418532c4cd38292f343" }, "downloads": -1, "filename": "aiofiles-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4d1c68c35b1edc41faf1e28195275814", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8208, "upload_time": "2015-04-06T22:55:01", "url": "https://files.pythonhosted.org/packages/13/5c/57a0e721cb9dc288f91788aff33c38b5398b7f7bb576c329291ad7cdc553/aiofiles-0.2.1-py3-none-any.whl" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "1a295fe959f71b537826c912fc1a69c1", "sha256": "6fda301a4395add1488172e63770124853973063cccc70e94ea547df5118d644" }, "downloads": -1, "filename": "aiofiles-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1a295fe959f71b537826c912fc1a69c1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9220, "upload_time": "2016-02-24T23:48:18", "url": "https://files.pythonhosted.org/packages/10/5c/b9e24ae45f299709330a9b7f2f50de9414a2654a419d51c3b24e7f5565a4/aiofiles-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "47e1dc40054cfc76c47172e9d921a8ed", "sha256": "795099c45d641c51774cadbd080395fd7b02c0222f7fd8a298533d78c0dff0e4" }, "downloads": -1, "filename": "aiofiles-0.3.0.tar.gz", "has_sig": false, "md5_digest": "47e1dc40054cfc76c47172e9d921a8ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5468, "upload_time": "2016-09-02T23:15:13", "url": "https://files.pythonhosted.org/packages/a5/b7/ed75c9502a2595d9c5550ee5323d591cf5e4a81323bea16b2284ef1165ca/aiofiles-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "2d35af0fb37c9f7cddef4858f6de7f8c", "sha256": "cbe1bfc5513d53d084fcd887c205d651d97bc5b3a2e5fd4f5a8601ef89ad4c35" }, "downloads": -1, "filename": "aiofiles-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2d35af0fb37c9f7cddef4858f6de7f8c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9211, "upload_time": "2017-03-10T00:06:47", "url": "https://files.pythonhosted.org/packages/57/db/9fe57c9d59afc5c5fb9cc5a666c25dcabb35babb5e4527d9386d9d6a8928/aiofiles-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "98ad96308fb9c6757609c70c4a1ddf08", "sha256": "6c4936cea65175277183553dbc27d08b286a24ae5bd86f44fbe485dfcf77a14a" }, "downloads": -1, "filename": "aiofiles-0.3.1.tar.gz", "has_sig": false, "md5_digest": "98ad96308fb9c6757609c70c4a1ddf08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5472, "upload_time": "2017-03-10T00:06:50", "url": "https://files.pythonhosted.org/packages/28/51/913ed4312b63b0a1b6cad5a761b2c163eb20e353c7a3f19f08e04e8675e5/aiofiles-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "92accae61c5663007c7aed93167335f3", "sha256": "25c66ea3872d05d53292a6b3f7fa0f86691512076446d83a505d227b5e76f668" }, "downloads": -1, "filename": "aiofiles-0.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "92accae61c5663007c7aed93167335f3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9948, "upload_time": "2017-10-23T17:32:19", "url": "https://files.pythonhosted.org/packages/0b/39/bb20653b60bab6ba036f13f7eae91a232b63394d4a04ae08efd45f434222/aiofiles-0.3.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "726de778d9e4b1c6d5e4d04994a03505", "sha256": "852a493a877b73e11823bfd4e8e5ef2610d70d12c9eaed961bcd9124d8de8c10" }, "downloads": -1, "filename": "aiofiles-0.3.2.tar.gz", "has_sig": false, "md5_digest": "726de778d9e4b1c6d5e4d04994a03505", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9853, "upload_time": "2017-10-23T17:32:21", "url": "https://files.pythonhosted.org/packages/a4/49/f983f0bc7572edad5bbbaf0f91087f1448aee8ba55046f15bb464fb8bb63/aiofiles-0.3.2.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "5b91c789d9f91542ced731a5dadd33d8", "sha256": "1e644c2573f953664368de28d2aa4c89dfd64550429d0c27c4680ccd3aa4985d" }, "downloads": -1, "filename": "aiofiles-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5b91c789d9f91542ced731a5dadd33d8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9191, "upload_time": "2018-08-11T17:24:07", "url": "https://files.pythonhosted.org/packages/cf/f2/a67a23bc0bb61d88f82aa7fb84a2fb5f278becfbdc038c5cbb36c31feaf1/aiofiles-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cb33cf96c371fbd56fc27ab0bd81bd61", "sha256": "021ea0ba314a86027c166ecc4b4c07f2d40fc0f4b3a950d1868a0f2571c2bbee" }, "downloads": -1, "filename": "aiofiles-0.4.0.tar.gz", "has_sig": false, "md5_digest": "cb33cf96c371fbd56fc27ab0bd81bd61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9270, "upload_time": "2018-08-11T17:24:08", "url": "https://files.pythonhosted.org/packages/94/c2/e3cb60c1b7d9478203d4514e2d33ea424ad9bb98e45b21d6225db93f25c9/aiofiles-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5b91c789d9f91542ced731a5dadd33d8", "sha256": "1e644c2573f953664368de28d2aa4c89dfd64550429d0c27c4680ccd3aa4985d" }, "downloads": -1, "filename": "aiofiles-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5b91c789d9f91542ced731a5dadd33d8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9191, "upload_time": "2018-08-11T17:24:07", "url": "https://files.pythonhosted.org/packages/cf/f2/a67a23bc0bb61d88f82aa7fb84a2fb5f278becfbdc038c5cbb36c31feaf1/aiofiles-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cb33cf96c371fbd56fc27ab0bd81bd61", "sha256": "021ea0ba314a86027c166ecc4b4c07f2d40fc0f4b3a950d1868a0f2571c2bbee" }, "downloads": -1, "filename": "aiofiles-0.4.0.tar.gz", "has_sig": false, "md5_digest": "cb33cf96c371fbd56fc27ab0bd81bd61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9270, "upload_time": "2018-08-11T17:24:08", "url": "https://files.pythonhosted.org/packages/94/c2/e3cb60c1b7d9478203d4514e2d33ea424ad9bb98e45b21d6225db93f25c9/aiofiles-0.4.0.tar.gz" } ] }