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.2.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: asyncinit-0.2.2.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for asyncinit-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a337e070e3c03129e1a50065eb37794b73f21498a50aa850236056f439b486a0
MD5 7f92a69d1f147382743828906a72df8a
BLAKE2b-256 f57ff984f656f63c431bac89765d0d92d9b23e2f70d769f8a59a2d58f6b2555b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncinit-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for asyncinit-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6e82addb3911e2243271a34f31944f1a7ca5ffeff59420587983cebe05f0dd19
MD5 a379ac77a820c1c8c7b4b12cdc859ef7
BLAKE2b-256 5d70d83b8ffaf97bfd425a52e838dd3ff053e7f1e3c9f810d6f98aff29d8f943

See more details on using hashes here.

Supported by

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