# asyncinit -- Enable async `__init__`
[Documentation](http://kchmck.github.io/pdoc/asyncinit/)
This package provides the `asyncinit` decorator, which enables an asynchronous constructor
to be called like any other asynchronous function.
## Example
```python
from asyncinit import asyncinit
@asyncinit
class MyClass:
async def __init__(self, param):
self.val = await self.deferredFn(param)
async def deferredFn(self, x):
# ...
return x + 2
obj = await MyClass(42)
assert obj.val == 44
```
## Installation
This package requires Python >= 3.5.0 and can be installed with `pip`:
```
pip install asyncinit
```
Raw data
{
"_id": null,
"home_page": "https://github.com/kchmck/pyasyncinit",
"name": "asyncinit",
"maintainer": "",
"docs_url": "https://pythonhosted.org/asyncinit/",
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "async init asyncio",
"author": "Mick Koch",
"author_email": "mick@kochm.co",
"download_url": "https://files.pythonhosted.org/packages/de/12/0679675f7acadba277a29d6a056e72be0b6486d60c689767b4bc7153f850/asyncinit-0.2.4.tar.gz",
"platform": "",
"description": "# asyncinit -- Enable async `__init__`\n\n[Documentation](http://kchmck.github.io/pdoc/asyncinit/)\n\nThis package provides the `asyncinit` decorator, which enables an asynchronous constructor\nto be called like any other asynchronous function.\n\n## Example\n\n```python\nfrom asyncinit import asyncinit\n\n@asyncinit\nclass MyClass:\n async def __init__(self, param):\n self.val = await self.deferredFn(param)\n\n async def deferredFn(self, x):\n # ...\n return x + 2\n\nobj = await MyClass(42)\nassert obj.val == 44\n```\n\n## Installation\n\nThis package requires Python >= 3.5.0 and can be installed with `pip`:\n```\npip install asyncinit\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Class decorator to enable async __init__",
"version": "0.2.4",
"split_keywords": [
"async",
"init",
"asyncio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b412a73bd1bcba7f99738d1f644ed17b526f84e97aaabda301800435ca202570",
"md5": "0be5cead4ef2a7b05f7c596cc02b8a40",
"sha256": "9f11291943488abd15a1463dad98452e3bd6b39e8e6d45bc7cc008a09825b11e"
},
"downloads": -1,
"filename": "asyncinit-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0be5cead4ef2a7b05f7c596cc02b8a40",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 2820,
"upload_time": "2018-10-19T17:32:59",
"upload_time_iso_8601": "2018-10-19T17:32:59.287367Z",
"url": "https://files.pythonhosted.org/packages/b4/12/a73bd1bcba7f99738d1f644ed17b526f84e97aaabda301800435ca202570/asyncinit-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "de120679675f7acadba277a29d6a056e72be0b6486d60c689767b4bc7153f850",
"md5": "abca9e6f781b84dd202eba40ce55ac62",
"sha256": "4acaf614f4d6f78babd278bbacf21bd9f7756efc17cd5d7e1bae31ff770b3cfa"
},
"downloads": -1,
"filename": "asyncinit-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "abca9e6f781b84dd202eba40ce55ac62",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 2338,
"upload_time": "2018-10-19T17:33:00",
"upload_time_iso_8601": "2018-10-19T17:33:00.792772Z",
"url": "https://files.pythonhosted.org/packages/de/12/0679675f7acadba277a29d6a056e72be0b6486d60c689767b4bc7153f850/asyncinit-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2018-10-19 17:33:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "kchmck",
"github_project": "pyasyncinit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "asyncinit"
}