Interface for easy access to asynchronous methods for synchronous users
Project description
SyncAsync
This library enables you to provide your asynchronous library to synchronous users, while still enabling you, to use it as intended.
Installation
pip install sync-async
Hello World
from SyncAsync import SyncAsync
class Example(SyncAsync):
@SyncAsync.sync
async def hello_world(self, txt: str):
print(txt)
def main(api: Example):
api.hello_world("Hello World")
async def aio_main(api: Example):
await api.hello_world("Hello Sky")
if __name__ == "__main__":
example = Example()
main(example) # Prints 'Hello World'
import asyncio
asyncio.get_event_loop().run_until_complete(aio_main(example)) # Prints 'Hello Sky'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sync_async_api-1.0.0.tar.gz
(20.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sync_async_api-1.0.0.tar.gz.
File metadata
- Download URL: sync_async_api-1.0.0.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c63d7564aee6c347c7d2a8ba997602b0a8dcdee7ebbc1e9103d8c4fdff95283
|
|
| MD5 |
0a2aaee950d0017c655f8676ec4bc69a
|
|
| BLAKE2b-256 |
cc140798548e33a37e1993ac1a0925607bc7b9862d81e4313efd4887ed1796e3
|
File details
Details for the file sync_async_api-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sync_async_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e6e220e2146535474d28682ca11dd584cc26dc6abda777ab5c27a8e08624a89
|
|
| MD5 |
a684e17fbc9249c1859aca91f4ae876d
|
|
| BLAKE2b-256 |
875c495047a4162dafb45976b12cc611937374d56ff3f6f857eb91df5e4662f8
|