Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.

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 hashes
Filename, size asyncinit-0.2.4.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View hashes

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