async4s - 一个简单易用的异步执行模块
About
这是一个简单易用的异步执行模块,可以使原有方法轻松变为异步执行。
Requirements
- Python3
Install
通过pip命令安装:
pip install async4s
Example
- async by thread
import time
from async4s.mw.thread import Master, Worker
def work(i):
time.sleep(i)
return i
def callback(results):
print(results)
print(time.perf_counter())
workers = [Worker(work, i) for i in range(5)]
m = Master(workers, callback)
print("main")
m.wait()
print(time.perf_counter())
- async by asyncio
import time
import asyncio
from async4s.mw.coroutine import Master, Worker
async def work(i):
await asyncio.sleep(i)
return i
def callback(results):
print(results)
print(time.perf_counter())
workders = (Worker(work, i) for i in range(5))
master = Master(workders, callback=callback)
print("main")
master.wait()
print(time.perf_counter())
Release History
0.0.1(2021-01-26)
- Birth
1.0.0(2021-10-29)
- Master-Worker mode
- both implement by thread and asyncio
Author
Metadata
Release files for async4s 2.4.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 |
|---|---|---|---|---|
| async4s-2.4.0.zip | 14.3 kB | Without provenance | Details for async4s-2.4.0.zip |
Release files / async4s-2.4.0.zip
| Download URL | async4s-2.4.0.zip |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab0aa3cb5f76dc85c6b5506c5f0968ae91292cc20d35456cfb11ccd5d879ce06
|
|
BLAKE2b-256 checksum How to use checksums |
d53f51835d507d79175b96bf5176bfd279019231597f794766f605920ac719f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.5
|
Security for async4s 2.4.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.