Skip to main content

Python decorator for async properties.

Project description

async_property

https://img.shields.io/pypi/v/async_property.svg https://img.shields.io/travis/ryananguiano/async_property.svg Documentation Status Updates

Python decorator for async properties.

Install

To install async_property, run this command in your terminal:

$ pip install async_property

Or if you have pipenv:

$ pipenv install async_property

Usage

You can use @async_property just as you would with @property, but on a async function.

class Foo:
    @async_property
    async def remote_value(self):
        return await get_remote_value()

The property remote_value now returns an awaitable coroutine.

instance = Foo()
await instance.remote_value

Features

  • Both regular and cached property.

  • Cached properties can be accessed multiple times without repeating function.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

The ObjectProxy class was taken from wrapt library by Graham Dumpleton.

History

0.1.0 (2019-04-11)

  • First release on PyPI.

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

async_property-0.1.0.tar.gz (13.5 kB view hashes)

Uploaded Source

Built Distribution

async_property-0.1.0-py2.py3-none-any.whl (9.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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