Desync
Simple conversions between synchronous and asynchronous functions and function
calls. You can use it to wait (really block) for asynchronous function results
with sync or create synchronous versions with synced:
# Assume async_func is asynchronous.
async_func: Callable[..., Awaitable[T]]
# Call async_func and wait for its result synchronously:
result: T = sync(async_func, *args, **kwargs)
# Create a version which is synchronous without calling it:
desynced_func: Callable[..., T] = synced(async_func)
You can also wait for synchronous functions via desync or create asynchronous
versions with desynced:
# Assume sync_func is synchronous.
func: Callable[..., T]
# Call sync_func and wait for its result in an asynchronous context:
awaitable: Awaitable[T] = desync(sync_func, *args, **kwargs)
result: T = await awaitable
# Create a version which is asynchronous without calling it:
descyned_func: Callable[..., Awaitable[T]] = desynced(func)
Desynced functions run in parallel (as far as python can run in parallel).
def wait_some():
time.sleep(1)
return 1
# This should take approx. 1 second:
assert 10 == sum(
await asyncio.gather(*(
desync(wait_some) for i in range(10)
))
)
Metadata
Release files for pydesync 0.1.3
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 |
|---|---|---|---|---|
| pydesync-0.1.3.tar.gz | 7.5 kB | Without provenance | Details for pydesync-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydesync-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pydesync-0.1.3-py3-none-any.whl |
Total release size: 14.4 kB
Release files / pydesync-0.1.3.tar.gz
| Download URL | pydesync-0.1.3.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e78b4e4d146a123b224bba5562d4fbc1d749eea5b0ad4764ab8f39d2b1bc23c
|
|
BLAKE2b-256 checksum How to use checksums |
4396fa4e7d3f63bc018c03e8da6ed425c87c6b945f0e909b4c02ab8f428eddc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.12
|
Release files / pydesync-0.1.3-py3-none-any.whl
| Download URL | pydesync-0.1.3-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e2a43e28aba73a9c6b96a96157a884d7b05c26c256a660ac3e247db5af98e5c
|
|
BLAKE2b-256 checksum How to use checksums |
11b6fe352e3165ba95dde68bef06465275622afba7ef7d407cd2ec3e948d56ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.12
|
Security for pydesync 0.1.3
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.