Skip to main content

A decorator to asynchronously execute synchronous functions

Project description

Awaitable

Travis CI Build Status CircleCI Build Status PyPI - Version PyPI - Python Version

Description: A decorator to asynchronously execute synchronous functions

Copyright: 2022 Fabio Castelli (Muflone) muflone@muflone.com

License: GPL-3+

Source code: https://github.com/muflone/awaitable

Documentation: http://www.muflone.com/awaitable/

Description

Awaitable is a small decorator to asynchronously execute synchronous functions.

System Requirements

  • Python 3.x

Usage

You can decorate a synchronous routine using @awaitable.awaitable to make it awaitable and awaitable.AsyncioGather to process some tasks using asyncio:

import awaitable

@awaitable.awaitable
def do_something():
    # process a single task
    return

async def process(count):
    # execute some workers
    tasks = awaitable.AsyncioGather()
    for i in range(count):
        tasks.add(do_something())
    await tasks.run()

awaitable.run_awaitable(func=process, count=10)

Please see the samples folders for some others usage examples.

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

Awaitable-0.2.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

Awaitable-0.2.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file Awaitable-0.2.1.tar.gz.

File metadata

  • Download URL: Awaitable-0.2.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for Awaitable-0.2.1.tar.gz
Algorithm Hash digest
SHA256 07aa731303f617f55da5c2f07c3674d4f0c8d640bcc6af15f0f08f8ea916d82e
MD5 ada10eead41e6bc425b20fe0b5a803a4
BLAKE2b-256 b6feade18d2e7219db16fd985d8658c3cc6830b9644757aa1b1e9870059c4fd8

See more details on using hashes here.

File details

Details for the file Awaitable-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: Awaitable-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for Awaitable-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49e042c0bb8313668e5f418a7032fb139675388d9f44940ccac446a70d758f2b
MD5 05eef918ecaa52999423f689c52fa65a
BLAKE2b-256 d49a0cab2b6bf5caadc0d77e5e448fd705598dadc8fb96ef818b07bf2d52a7a0

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