Assume that you have some existing libraries with blocking methods:
def foo_sync(x, a, b):
"""Some existing library methods. Sleeps for x seconds and returns a + b."""
time.sleep(x)
return a + b
And you are writing a program in Python3’s asyncio framework. To use the blocking library, one way is to use a thread pool. This library provides another option:
# Wraps foo_sync() into foo_async() to use in asyncio framework. time.sleep = aiowrap.wrap_async(asyncio.sleep) foo_async = aiowrap.wrap_sync(foo_sync)
Now you have an asynchronous, non-blocking version of the method, you can call it inside your favourite coroutine:
async def main():
print(await foo_async(1, 2, 3))
The source code of this example can be found at example/sleep.py.
Metadata
Release files for aiowrap 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiowrap-0.1.1.tar.gz | 1.6 kB | Without provenance | Details for aiowrap-0.1.1.tar.gz |
Release files / aiowrap-0.1.1.tar.gz
| Download URL | aiowrap-0.1.1.tar.gz |
|---|---|
| Size | 1.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0066270a9f61403e76d47ebb0023f793e28336e0ca45b513ebcc088cc41e22d
|
|
BLAKE2b-256 checksum How to use checksums |
56b037b565f801d9b6f7badf16920f3c69bd2b5cb3e6964a7eb259ddb90eabaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for aiowrap 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.