Skip to main content

promisio

Build status codecov

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

Metadata

Release files for promisio 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for promisio 0.2
File Size Uploaded Provenance Actions
promisio-0.2.tar.gz 11.7 kB Without provenance Details for promisio-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for promisio 0.2
File Interpreter ABI Platform Actions
promisio-0.2-py3-none-any.whl Python 3 none any Details for promisio-0.2-py3-none-any.whl

Total release size: 17.3 kB

Release files / promisio-0.2.tar.gz

Download URL promisio-0.2.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
80fdb440254c8b4ac390c9bd3aadc784d3a0684163add243c095abbaa98ea098
BLAKE2b-256 checksum
How to use checksums
b261caeb325f5a5b4cfa0f0538e1cef5de8acae42d099046564729cee8ed5d00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / promisio-0.2-py3-none-any.whl

Download URL promisio-0.2-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
804d9a35ced1aac079a06319bc31a98ef218b5bb65a18e1cf280335bf78c4f9e
BLAKE2b-256 checksum
How to use checksums
9d27cdff9e9582bf76399585e864f30d6c0594a303f9b7dc32cbd487c4e84cef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for promisio 0.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page