async-interrupt
Context manager to raise an exception when a future is done
Decision gist · record as of 2026-08-14
Yes. The package is lightweight, actively maintained, has no dependencies, supports current Python versions, carries no known vulnerabilities, and solves a specific asyncio coordination problem with a permissive license. Install it if you need future-based interruption with minimal race-condition risk.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low install friction with no runtime dependencies.
- Actively maintained with a recent release (2025-02-22) and ongoing repository activity.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2025-02-22 (538 days) · last repo commit 2026-08-10 · 2 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 907,830 downloads/mo, #4,756 on PyPI
Alternatives
Verify before relying
pip install async_interrupt
import asyncio
from async_interrupt import interrupt
async def example():
future = asyncio.Future()
async with interrupt(future, ValueError, "message"):
future.set_result(None)
await asyncio.sleep(0)- Whether the package handles edge cases like nested interrupts or multiple concurrent futures.
- Performance characteristics when used with high-frequency future completions.
- Detailed comparison to cpython asyncio.timeout behavior and when to choose one over the other.
What it is and what it does
async_interrupt is a lightweight asyncio utility that provides a context manager for raising an exception as soon as a future completes. It wraps a code block and monitors a supplied future; when that future is done, the context manager raises a specified exception with an optional message. The design prioritizes minimizing race conditions by raising as promptly as possible.
The package has no runtime dependencies and is built for modern Python versions (3.9–3.13). It draws inspiration from async_timeout and cpython's asyncio.timeout, making it a focused alternative for scenarios where you need fine-grained control over future-based interruption. With active maintenance and a permissive Apache-2.0 license, it is production-ready for integration into async workflows.
Use it for
- Cancel long-running async operations when an external signal (represented as a future) fires.
- Implement custom timeout or deadline logic by raising an exception tied to a future's completion.
- Coordinate async task interruption across multiple coroutines without race conditions.
- Build async state machines that respond to external events by raising controlled exceptions.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is lightweight, actively maintained, has no dependencies, supports current Python versions, carries no known vulnerabilities, and solves a specific asyncio coordination problem with a permissive license. Install it if you need future-based interruption with minimal race-condition risk.
Install
async-interrupt on PyPI
Before you install
Low install friction with no runtime dependencies. Actively maintained with a recent release (2025-02-22) and ongoing repository activity. Supports Python 3.9 through 3.13.
Requires Python 3.9 or later.
License in practice
Licensed under Apache-2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install async_interrupt
import asyncio
from async_interrupt import interrupt
async def example():
future = asyncio.Future()
async with interrupt(future, ValueError, "message"):
future.set_result(None)
await asyncio.sleep(0)
Verify before relying
- Whether the package handles edge cases like nested interrupts or multiple concurrent futures.
- Performance characteristics when used with high-frequency future completions.
- Detailed comparison to cpython asyncio.timeout behavior and when to choose one over the other.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 538 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 907,830 / month, #4,756 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries |
Evidence: async_interrupt-1.2.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “asyncio interrupt context manager”
- async-interruptProvides an asyncio context manager that interrupts a block of code…
- stopitProvides context managers and decorators to enforce timeouts on code…
- interruptingcowInterrupts long-running Python code by raising an exception after a…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also interruptingcow · async-timeout · aiousbwatcher · cysignals · stopit · aiozoneinfo · wait-for2 · aiohappyeyeballs · taskgroup · jaraco.context