Promisio
JavaScript-style async programming for Python.
Install / Use
/learn @miguelgrinberg/PromisioREADME
promisio
JavaScript-style async programming for Python.
Examples
Create a promise-based async function using the promisify decorator. It works
on both sync and async functions!
from promisio import promisify
@promisify
async def f():
await asyncio.sleep(1)
return 42
@promisify
def g(x):
return x * 2
async def main():
print(await f()) # prints 42
print(await g(42)) # prints 84
promise = f() # runs function in the background without waiting
# ... do other stuff here in parallel with f running
await promise # finally wait for f to complete
The return value of the decorated function is a JavaScript-style promise object
that can be awaited. The then(), catch() and finally_() methods to chain
promises work as in JavaScript. The Promise.all(), Promise.all_settled(),
Promise.any(), Promise.race(), Promise.resolve() and Promise.reject()
are also available. Promises in this package are extended to also support
cancellation via the cancel() and cancelled() methods.
Resources
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
