Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

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.

Filename, size & hash SHA256 hash help File type Python version Upload date
asyncinit-0.2.4-py3-none-any.whl (2.8 kB) Copy SHA256 hash SHA256 Wheel py3 Oct 19, 2018
asyncinit-0.2.4.tar.gz (2.3 kB) Copy SHA256 hash SHA256 Source None Oct 19, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page