{ "info": { "author": "Ryan Anguiano", "author_email": "ryan.anguiano@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "==============\nasync_property\n==============\n\n\n.. image:: https://img.shields.io/pypi/v/async_property.svg\n :target: https://pypi.org/project/async-property/\n\n.. image:: https://img.shields.io/travis/ryananguiano/async_property.svg\n :target: https://travis-ci.org/ryananguiano/async_property\n\n.. image:: https://readthedocs.org/projects/async-property/badge/?version=latest\n :target: https://async-property.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://pyup.io/repos/github/ryananguiano/async_property/shield.svg\n :target: https://pyup.io/repos/github/ryananguiano/async_property/\n :alt: Updates\n\n\nPython decorator for async properties.\n\n* Free software: MIT license\n* Documentation: https://async-property.readthedocs.io\n* Package: https://pypi.org/project/async-property\n* Source code: https://github.com/ryananguiano/async_property\n\nInstall\n-------\n\nTo install async_property, run this command in your terminal:\n\n.. code-block:: console\n\n $ pip install async-property\n\n\nOr if you have pipenv:\n\n.. code-block:: console\n\n $ pipenv install async-property\n\n\nUsage\n-----\n\nYou can use ``@async_property`` just as you would with ``@property``, but on an async function.\n\n.. code-block:: python\n\n class Foo:\n @async_property\n async def remote_value(self):\n return await get_remote_value()\n\nThe property ``remote_value`` now returns an awaitable coroutine.\n\n.. code-block:: python\n\n instance = Foo()\n await instance.remote_value\n\n\nCached Properties\n~~~~~~~~~~~~~~~~~\n\n``@async_cached_property`` will call the function only once. Subsequent awaits to the property will return a cached value.\n\n.. code-block:: python\n\n class Foo:\n @async_cached_property\n async def value(self):\n print('loading value')\n return 123\n\n >>> instance = Foo()\n >>> instance.value\n \n\n >>> await instance.value\n loading value\n 123\n >>> await instance.value\n 123\n >>> instance.value\n 123\n\n >>> instance.value = 'abc'\n >>> instance.value\n 'abc'\n >>> await instance.value\n 'abc'\n\n >>> del instance.value\n >>> await instance.value\n loading value\n 123\n\n\nAwaitLoader\n~~~~~~~~~~~\n\nIf you have an object with multiple cached properties, you can subclass ``AwaitLoader``. This will make your class instances awaitable and will load all ``@async_cached_property`` fields concurrently. ``AwaitLoader`` will call ``await instance.load()``, if it exists, before loading properties.\n\n.. code-block:: python\n\n\n class Foo(AwaitLoader):\n async def load(self):\n print('load called')\n\n @async_cached_property\n async def db_lookup(self):\n return 'success'\n\n @async_cached_property\n async def api_call(self):\n return 'works every time'\n\n >>> instance = await Foo()\n load called\n >>> instance.db_lookup\n 'success'\n >>> instance.api_call\n 'works every time'\n\nFeatures\n--------\n\n* Both regular and cached property.\n* ``@async_cached_property`` can be accessed multiple times without repeating function call.\n* ``@async_cached_property`` uses asyncio.Lock to ensure function is called only once per instance.\n* Full test coverage with py.test\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\nThe ObjectProxy_ class was taken from wrapt_ library by Graham Dumpleton.\n\n.. _ObjectProxy: https://github.com/GrahamDumpleton/wrapt/blob/master/src/wrapt/wrappers.py\n.. _wrapt: https://github.com/GrahamDumpleton/wrapt\n\n\n=======\nHistory\n=======\n\n0.2.1 (2019-04-13)\n------------------\n\n* Update docs and readme\n\n0.2.0 (2019-04-12)\n------------------\n\n* Use instance state to hold cache and locks\n\n0.1.4 (2019-04-12)\n------------------\n\n* Fix inheritance issues on AwaitLoader\n\n0.1.3 (2019-04-12)\n------------------\n\n* Cleanup code\n\n0.1.2 (2019-04-12)\n------------------\n\n* Fix asyncio.Lock issues\n\n0.1.1 (2019-04-11)\n------------------\n\n* Complete test coverage and update readme\n\n\n0.1.0 (2019-04-11)\n------------------\n\n* First release on PyPI.\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/ryananguiano/async_property", "keywords": "async_property", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "async-property", "package_url": "https://pypi.org/project/async-property/", "platform": "", "project_url": "https://pypi.org/project/async-property/", "project_urls": { "Homepage": "https://github.com/ryananguiano/async_property" }, "release_url": "https://pypi.org/project/async-property/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Python decorator for async properties.", "version": "0.2.1" }, "last_serial": 5139787, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b9fb32150fa394ba629724752144a296", "sha256": "a4905cd9217ec86c8e70a5c23281a4525455fd2aad279fc802ce35a2d25de350" }, "downloads": -1, "filename": "async_property-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b9fb32150fa394ba629724752144a296", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9164, "upload_time": "2019-04-11T19:51:26", "url": "https://files.pythonhosted.org/packages/3f/37/27444118f76941d6554675a33cbf812ff96333f359458058919003ac2ad7/async_property-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50de104fbab5f726b4bcdf33493ac101", "sha256": "c51ba1ff7ab38605d38d271214afcbbf76dbb4e3fc8e753ec203224d955cedc3" }, "downloads": -1, "filename": "async_property-0.1.0.tar.gz", "has_sig": false, "md5_digest": "50de104fbab5f726b4bcdf33493ac101", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13452, "upload_time": "2019-04-11T19:51:29", "url": "https://files.pythonhosted.org/packages/71/38/03da85c7e343e0e54446476d491b02d58f0274d1e8ea9092d0b4d2294b0e/async_property-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ac030e4ef3e9b4d7b5c3b4120d795edb", "sha256": "5d393560f072bfb36db716f0f39665577b3d457d3218a7c48b89c7ba15a2e0fd" }, "downloads": -1, "filename": "async_property-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ac030e4ef3e9b4d7b5c3b4120d795edb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9546, "upload_time": "2019-04-12T00:18:09", "url": "https://files.pythonhosted.org/packages/c8/75/7e0a7697a3bc8220cf6ed41ce9a480478b41831e7f07fd0760778fcb2aa8/async_property-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3e382a4ea3d4e5582cfd80a4870896d1", "sha256": "1a377ff936aa1ecb7b3736f36c05f3ab45cbe057d9e5ffaeb91ebb88b88aa3ad" }, "downloads": -1, "filename": "async_property-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3e382a4ea3d4e5582cfd80a4870896d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14250, "upload_time": "2019-04-12T00:18:11", "url": "https://files.pythonhosted.org/packages/fd/bc/8c4620b5106c9332bd7de30ad3d3809b18542672aadc5f390aa9b67b9f04/async_property-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "f0e029a10921ac507b3fcf9452062406", "sha256": "730e1b6d635d08296e3c735930eb5613614b4210c48b3fca6167c519b6a1e0c4" }, "downloads": -1, "filename": "async_property-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f0e029a10921ac507b3fcf9452062406", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8870, "upload_time": "2019-04-12T04:36:38", "url": "https://files.pythonhosted.org/packages/7f/5e/5bccf351cebefd1579e5c6629c62666d4cf94b93e187fd3ae518578df016/async_property-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "03e3e2aeed5d044cc715ee83e1600e5a", "sha256": "6a812e0af09dab0abeea3a2c1f8cd25e75846e7aa8e6aa40f89b41415f074dc4" }, "downloads": -1, "filename": "async_property-0.1.2.tar.gz", "has_sig": false, "md5_digest": "03e3e2aeed5d044cc715ee83e1600e5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14132, "upload_time": "2019-04-12T04:36:39", "url": "https://files.pythonhosted.org/packages/0f/4e/5486d87d1be3cf7ee0efc4501bd819fe0e4986fae3b4622eaedb0acb7ed0/async_property-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "0e208c3e0661b85ebab509c82c657b57", "sha256": "03cf40019c174716033ded91dae72d8f1663890ee80929495798d99e4725d32e" }, "downloads": -1, "filename": "async_property-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0e208c3e0661b85ebab509c82c657b57", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8933, "upload_time": "2019-04-12T05:51:41", "url": "https://files.pythonhosted.org/packages/b5/e2/3e3cac06ee905621605e4a1412efdb625e292a1bb6e8034fbe0c2af12c25/async_property-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "32b6f431d17923e9481001156e06688c", "sha256": "13ce162d62f9d3825f4b240a4d5e771b8fc01475d3b6f4ea4811a58d11812028" }, "downloads": -1, "filename": "async_property-0.1.3.tar.gz", "has_sig": false, "md5_digest": "32b6f431d17923e9481001156e06688c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14221, "upload_time": "2019-04-12T05:51:42", "url": "https://files.pythonhosted.org/packages/dc/99/f2db0ce77c03117f051011d37dde4c59e68c0d8d1a6b34173b266b227228/async_property-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "39953a56d16697e3f30f8beeba044329", "sha256": "513d013534c7d75fd31b8f50ae233c5d8f018d61521f3ad886937841ce943512" }, "downloads": -1, "filename": "async_property-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "39953a56d16697e3f30f8beeba044329", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9138, "upload_time": "2019-04-12T09:18:17", "url": "https://files.pythonhosted.org/packages/d0/42/6099789e8a5de83e30907ddaf10f2416afb7268902faa3f7d2ae38db2b34/async_property-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "af745c35851043cab7e35cec5b0267ae", "sha256": "8fcaad69ab05607f3467730869e38c1c4bda583497421d67865390153f3e551d" }, "downloads": -1, "filename": "async_property-0.1.4.tar.gz", "has_sig": false, "md5_digest": "af745c35851043cab7e35cec5b0267ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14647, "upload_time": "2019-04-12T09:18:18", "url": "https://files.pythonhosted.org/packages/26/da/bb91ab7149b8aa9158a9271d4a61504ba6298d564a6d6db373f7529afcc3/async_property-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d9b415ba5d67cdaf0e4f5e2de984252d", "sha256": "3ba8d20b21986e72864d682e7e35e53ccf4f97be0bec9e34e83be163bddf9515" }, "downloads": -1, "filename": "async_property-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d9b415ba5d67cdaf0e4f5e2de984252d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9327, "upload_time": "2019-04-12T17:29:38", "url": "https://files.pythonhosted.org/packages/a5/25/9dc6c514f466a40012d05f5401990caffc5a3757e7e3c17f54a34746e842/async_property-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ae9f33592412ea65e76b43b64c98b9ab", "sha256": "e9070c9dbc4a68773f7d9ab0789fdc9014073ec35df2512bc90eb00bb6a89a20" }, "downloads": -1, "filename": "async_property-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ae9f33592412ea65e76b43b64c98b9ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14929, "upload_time": "2019-04-12T17:29:39", "url": "https://files.pythonhosted.org/packages/5d/a5/a01185e153f9753c9ec9e98e5f914d129870623f0f636828576f36c654e0/async_property-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "8cb0916ca83e94c5da583a5fe8cb99b4", "sha256": "f1f105009a6216ed9a13031aa13632754ed8a5c2e329fb8f9f2082d83529eacd" }, "downloads": -1, "filename": "async_property-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8cb0916ca83e94c5da583a5fe8cb99b4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9437, "upload_time": "2019-04-14T03:34:22", "url": "https://files.pythonhosted.org/packages/40/6b/40354fada6f6ed9a38a16220c89ccdd43d96a9565db68467ca27ec059bbf/async_property-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9bba6594633bb68c46dff0f1c2a9d66e", "sha256": "53826fd45a67d7d6cca3d7abbc0e8ba951f7c7618c830021fbd3675979b0b67d" }, "downloads": -1, "filename": "async_property-0.2.1.tar.gz", "has_sig": false, "md5_digest": "9bba6594633bb68c46dff0f1c2a9d66e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15096, "upload_time": "2019-04-14T03:34:23", "url": "https://files.pythonhosted.org/packages/94/00/ade26bd5fdb637e2e83b537113a5b03d5288da673384ff415b629be9e0d6/async_property-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8cb0916ca83e94c5da583a5fe8cb99b4", "sha256": "f1f105009a6216ed9a13031aa13632754ed8a5c2e329fb8f9f2082d83529eacd" }, "downloads": -1, "filename": "async_property-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8cb0916ca83e94c5da583a5fe8cb99b4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9437, "upload_time": "2019-04-14T03:34:22", "url": "https://files.pythonhosted.org/packages/40/6b/40354fada6f6ed9a38a16220c89ccdd43d96a9565db68467ca27ec059bbf/async_property-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9bba6594633bb68c46dff0f1c2a9d66e", "sha256": "53826fd45a67d7d6cca3d7abbc0e8ba951f7c7618c830021fbd3675979b0b67d" }, "downloads": -1, "filename": "async_property-0.2.1.tar.gz", "has_sig": false, "md5_digest": "9bba6594633bb68c46dff0f1c2a9d66e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15096, "upload_time": "2019-04-14T03:34:23", "url": "https://files.pythonhosted.org/packages/94/00/ade26bd5fdb637e2e83b537113a5b03d5288da673384ff415b629be9e0d6/async_property-0.2.1.tar.gz" } ] }