pySyncAsync
A library for template generation of synchronous and asynchronous functions in Python.
- [Release Notes](#Release Notes)
-
- [Version 0.0.1](#Version 0.0.1)
-
- [Version 1.0.0](#Version 1.0.0)
- Installation
- [Quick start](#Quick start)
- [User guide](#User guide)
-
- [Root manager](#Root manager)
-
- [Call object](#Call object)
-
- [Template function](#Template function)
- Examples
Release Notes
Version 0.0.1
Doesn't work, only library base
Version 1.0.0
- Add README
- Add Manager class
- Add root manager
- Add tests for import, common manager and root manager
Installation
You can install this library by download from GitHub:
git clone https://github.com/OlegYurchik/pySyncAsync
cd pySyncAsync
python setup.py install
or install from PyPI:
pip install pySyncAsync
Quick start
Just let me show simple code for set your templates and run them
import asyncio
import time
from random import randint
import pysyncasync as psa
@psa.register("sum")
def sync_func(a, b):
print("SUM SYNC START")
time.sleep(1)
return a + b
@psa.register("sum")
async def async_func(a, b):
print("SUM ASYNC START")
await asyncio.sleep(1)
return a + b
def worker():
a, b, c, d = (randint(0, 10**9) for _ in range(4))
call1 = psa.Call("sum", a, b)
yield call1
call2 = psa.Call("sum", c, d)
yield call2
call3 = psa.Call("sum", call1.result, call2.result)
yield call3
return call3.result
def main():
generated_worker = psa.generate(worker, psa.SYNC)
return generated_worker()
def a_main():
generated_worker = psa.generate(worker, psa.ASYNC)
loop = asyncio.get_event_loop()
return loop.run_until_complete(generated_worker())
if __name__ == "__main__":
print("SYNC SESSION")
main()
print("ASYNC SESSION")
a_main()
User guide
Manager
Root manager
Call object
Template function
Examples
Metadata
Release files for pySyncAsync 1.0.0
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 |
|---|---|---|---|---|
| pySyncAsync-1.0.0.tar.gz | 4.4 kB | Without provenance | Details for pySyncAsync-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pySyncAsync-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pySyncAsync-1.0.0-py3-none-any.whl |
Total release size: 10.9 kB
Release files / pySyncAsync-1.0.0.tar.gz
| Download URL | pySyncAsync-1.0.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50bc03146ee0b57061f7e52e95484316de2e9004ce0dc9d96364bd730a41a1dd
|
|
BLAKE2b-256 checksum How to use checksums |
0680dc7b3579271a68076fb111b5427decac684883f2734da3bc801f2cafbef3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Release files / pySyncAsync-1.0.0-py3-none-any.whl
| Download URL | pySyncAsync-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bff67810c0624486472f4d6fd5e783fbf4320fa6136def340a11a553c3283dd7
|
|
BLAKE2b-256 checksum How to use checksums |
85d1459f03c6ef3c4a9557a3ed1abdb161abb79ae1936aef3f3537f8d7d8cab0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Security for pySyncAsync 1.0.0
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.