This release is a pre-release and may not be stable for production use.
asyncloop
A Celery-like event loop with `asyncio` and no dependencies
It runs an asyncio event loop in a separate thread, drives native coroutines within the loop, and then returns the future in an asynchronous manner.
Dependency
It requires Python 3.5+.
Installation
$ git clone https://github.com/dgkim5360/asyncloop.git $ cd asyncloop asyncloop$ python setup.py install
Getting started
import asyncio as aio
from asyncloop import AsyncLoop
# A simple job, which should be a native coroutine
async def job_to_wait(sleep_sec):
await aio.sleep(sleep_sec)
return sleep_sec
# A simple callback
def callback(fut):
if fut.cancelled():
print('CANCELLED:', fut)
elif fut.done():
print('DONE:', fut)
print('RESULT:', fut.result()
# AsyncLoop starts
aloop = AsyncLoop() # <AsyncLoop(Thread-##, initial)>
aloop.start() # <AsyncLoop(Thread-##, started ##########)>
# Submit a job and be free to work on
# it returns an AsyncJob object, a simple wrapper of concurrent.Future
ajob = aloop.submit(job_to_wait(10), callback)
ajob # <AsyncJob at 0x####>
# After 10 seconds the callback activated
# DONE: <Future at 0x#### state=finished returned int>
# RESULT: 10
# Get a result
ret = ajob.result() # 10
# You MUST stop the aloop before exit or destroy
aloop.stop() # <AsyncLoop(Thread-##, stopped ##########)>
So far, that’s all.
Metadata
Release files for asyncloop 0.0.1.dev2
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 |
|---|---|---|---|---|
| asyncloop-0.0.1.dev2.tar.gz | 3.6 kB | Without provenance | Details for asyncloop-0.0.1.dev2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asyncloop-0.0.1.dev2-py3-none-any.whl | Python 3 | none | any | Details for asyncloop-0.0.1.dev2-py3-none-any.whl |
Total release size: 9.5 kB
Release files / asyncloop-0.0.1.dev2.tar.gz
| Download URL | asyncloop-0.0.1.dev2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c53ded99c97be8059213b2f12349c58e053f3f4c3f35aa993f7e1cb210aa3c13
|
|
BLAKE2b-256 checksum How to use checksums |
9832024effdfdc7ed82df04d0c6f2aa7cd39d763bf74e086ba7da4e492f7d97b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / asyncloop-0.0.1.dev2-py3-none-any.whl
| Download URL | asyncloop-0.0.1.dev2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a12e50e2934e5cee7893c0abf46ea3d267d7c602448c3bf16feddca7a989f664
|
|
BLAKE2b-256 checksum How to use checksums |
3500cee47ed2df703f0543c46bf63042e7f42e96b2758362aad60dbb958a3ada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for asyncloop 0.0.1.dev2
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.