skillfed

aiorun

Boilerplate for asyncio applications

aiorun v2025.1.1 313.0K downloads/30d#7,721 on PyPI470
Permissive license Active released

What it is and what it does

aiorun is a lightweight wrapper around asyncio that eliminates boilerplate for long-lived async applications. Instead of manually creating event loops, scheduling tasks, setting up signal handlers, and orchestrating graceful shutdown, you pass a coroutine to aiorun.run() and it handles the rest—creating the loop, running forever, catching SIGINT and SIGTERM, cancelling pending tasks, and closing cleanly.

The package is designed for servers and daemon-like applications that should keep running until explicitly stopped. Unlike the standard library's asyncio.run(), which exits when the coroutine completes, aiorun.run() runs indefinitely unless you call loop.stop() or an unhandled exception occurs (if stop_on_unhandled_errors=True is set). It automatically gathers and cancels all pending tasks during shutdown, waits for executor jobs to finish, and closes the event loop.

Use it for:

  • Building a TCP or HTTP server that needs clean signal handling and task cancellation on shutdown.
  • Running a long-lived async daemon or background worker that should survive transient errors.
  • Simplifying asyncio application startup when you want to avoid writing shutdown boilerplate.
  • Creating a resilient API service where one endpoint's exception shouldn't crash the entire process.
  • Prototyping async applications quickly without manually managing event loop lifecycle.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a simplified entry point for asyncio applications that handles event loop setup, signal handling, task cancellation, and graceful shutdown automatically.

Yes, if you are building asyncio-based servers or long-lived applications. The package eliminates common shutdown-sequence bugs and is actively maintained with zero known vulnerabilities. Install friction is minimal (no dependencies, pure Python). The only caveat: read the documentation carefully—aiorun.run() behaves differently from asyncio.run() (runs forever by default), which can surprise developers expecting standard library semantics.

Install

aiorun on PyPI

pip

pip install aiorun

uv

uv add aiorun

poetry

poetry add aiorun

Installing aiorun

Before you install

Low friction—pure Python, no runtime dependencies, and actively maintained with recent releases. Last commit was 2026-08-10 and the package supports current Python versions (3.8 through 3.12).

License in practice

Permissive license treatment means you can use this in commercial and proprietary projects without restrictive obligations.

Quickstart

import asyncio
from aiorun import run

async def main():
    await asyncio.sleep(1.0)

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

Requires Python 3.7 or later. Note that aiorun.run() runs forever by default—call loop.stop() inside your coroutine to exit, or pass stop_on_unhandled_errors=True to crash on exceptions.

Verify before relying

  • Whether the package's signal handling behavior (SIGINT, SIGTERM) is portable across Windows and Unix-like systems.
  • Performance characteristics when managing many concurrent tasks during shutdown.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 564 days since the last release
Last repo commit
First released
Downloads 312,982/month — #7,721 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: aiorun-2025.1.1-py3-none-any.whl

License :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

asyncio application boilerplateasyncio event loop runnergraceful shutdown asynciosignal handling async pythonasyncio task cancellationlong-running async serverasyncio startup shutdown
asyncioserver-boilerplate

More Application Frameworks packages