Skip to main content
https://travis-ci.org/cjrh/aiorun.svg?branch=master https://coveralls.io/repos/github/cjrh/aiorun/badge.svg?branch=master https://img.shields.io/pypi/pyversions/aiorun.svg https://img.shields.io/github/tag/cjrh/aiorun.svg https://img.shields.io/badge/install-pip%20install%20aiorun-ff69b4.svg https://img.shields.io/pypi/v/aiorun.svg https://img.shields.io/badge/calver-YYYY.MM.MINOR-22bfda.svg

ALPHA

aiorun

Here’s the big idea (how you use it):

import asyncio
from aiorun import run

async def main():
    # Put your application code here
    await asyncio.sleep(1.0)

if __name__ == '__main__':
    run(main())

This package provides a run() function as the starting point of your asyncio-based application.

So what the heck does run() do exactly?? It:

  • creates a Task for the given coroutine (schedules it on the event loop),

  • calls loop.run_forever(),

  • adds default (and smart) signal handlers for both SIGINT and SIGTERM that will stop the loop, and then it…

  • gathers all outstanding tasks,

  • cancels them using task.cancel() (you can choose whether or not to handle CancelledError in your coroutines),

  • waits for the executor to complete shutdown, and

  • finally closes the loop.

All of this stuff is boilerplate that you will never have to write again. So, if you use aiorun this is what you need to remember:

  • Spawn all your work from a single, starting coroutine

  • When a shutdown signal is received, all currently-pending tasks will have CancelledError raised internally. It’s up to you whether you want to handle this in a try/except or not.

  • Try to have executor jobs be shortish, since shutdown will wait for them to finish. If you need a long-running thread or process tasks, use a dedicated thread/subprocess and set daemon=True instead.

There’s not much else to know.

Metadata

Release files for aiorun 2017.10.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 aiorun 2017.10.2
File Size Uploaded Provenance
aiorun-2017.10.2.tar.gz 8.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiorun 2017.10.2
File Interpreter ABI Platform
aiorun-2017.10.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 23.6 kB

Release files / aiorun-2017.10.2.tar.gz

Download URL aiorun-2017.10.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7f7cb189aa9d279974b8501e78f84fb7281e12201f5e419269c7594039b0c8c1
BLAKE2b-256 checksum
How to use checksums
d37def30df9a0d34e2b1639d83df1b08de2d74a5e7fb3131fffaf01c7c2ac1da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / aiorun-2017.10.2-py2.py3-none-any.whl

Download URL aiorun-2017.10.2-py2.py3-none-any.whl
Size 15.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c7e572d7064cd2c82a9e71b86922429b191058cced71ca0fde2248e1066a7fe1
BLAKE2b-256 checksum
How to use checksums
14f2af1e52afdc68b0abf7d36096a5a645ba8af7b57edb6d5de6a6024c9f19bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for aiorun 2017.10.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.

Release history Release notifications | RSS feed

This release

2017.10.2 This release

2 release files No provenance

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