Skip to main content

Class decorator to enable async __init__

Project description

asyncinit -- Enable async __init__

Documentation

This package provides the asyncinit decorator, which enables an asynchronous constructor to be called like any other asynchronous function.

Example

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asyncinit-0.2.4.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

asyncinit-0.2.4-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file asyncinit-0.2.4.tar.gz.

File metadata

  • Download URL: asyncinit-0.2.4.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for asyncinit-0.2.4.tar.gz
Algorithm Hash digest
SHA256 4acaf614f4d6f78babd278bbacf21bd9f7756efc17cd5d7e1bae31ff770b3cfa
MD5 abca9e6f781b84dd202eba40ce55ac62
BLAKE2b-256 de120679675f7acadba277a29d6a056e72be0b6486d60c689767b4bc7153f850

See more details on using hashes here.

File details

Details for the file asyncinit-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: asyncinit-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for asyncinit-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9f11291943488abd15a1463dad98452e3bd6b39e8e6d45bc7cc008a09825b11e
MD5 0be5cead4ef2a7b05f7c596cc02b8a40
BLAKE2b-256 b412a73bd1bcba7f99738d1f644ed17b526f84e97aaabda301800435ca202570

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page