Skip to main content

async_to_sync

Convert async coroutine functions to normal ones.

Installation

$ pip install async_to_sync

Usage

import async_to_sync as sync

# an async object method to demonstrate use
class async_class:
    async def sum(self, a, b):
        return a + b
async_object = async_class()

# wrap all async methods of an object
sync_object = sync.methods(async_object)

assert sync_object.sum(1,2) == 3

# wrap a single async callable
sync_function = sync.function(async_object.sum)

assert sync_function(4,5) == 9

# wait for a coroutine
sync_result = sync.coroutine(async_object.sum(6,7))

assert sync_result == 13

# manually stop default event loop
sync.stop()

# manually start default event loop
sync.start()

Metadata

Release files for async-to-sync 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for async-to-sync 0.2.3
File Size Uploaded
async_to_sync-0.2.3.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for async-to-sync 0.2.3
File Interpreter ABI Platform
async_to_sync-0.2.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 7.6 kB

Release files / async_to_sync-0.2.3.tar.gz

Download URL async_to_sync-0.2.3.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
592b07f1644bae56202f13efa6a7b1f048ed9b24eb7c9e927e4064535273fcaa
BLAKE2b-256 checksum
How to use checksums
a00958fe9aab77d1eb62c7a1e8ee33d855588e9a073c1c14026d921cf5fc4e4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / async_to_sync-0.2.3-py2.py3-none-any.whl

Download URL async_to_sync-0.2.3-py2.py3-none-any.whl
Size 3.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
af509c8c849e00eff33c4d913b0c96ee93b755fa47d707615970615f41f08470
BLAKE2b-256 checksum
How to use checksums
7cf41ef6ab8c738ff41076d3f0314b7c8dc7d11c7c8ad825442e5754067d8a3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page