Skip to main content

Class decorator to enable async __init__

Project description

asyncinit -- Enable async __init__


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


from asyncinit import 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


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.

Files for asyncinit, version 0.2.4
Filename, size File type Python version Upload date Hashes
Filename, size asyncinit-0.2.4-py3-none-any.whl (2.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size asyncinit-0.2.4.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page