async-timeout
An asyncio-compatible timeout context manager for Python, now superseded by stdlib asyncio.timeout
Repository Health
Technical Analysis
async-timeout provides an async with timeout(delay): context manager for asyncio code, cancelling the wrapped block if it runs longer than the given delay and raising TimeoutError outside the block. It predates and directly inspired Python 3.11’s built-in asyncio.timeout().
The project is now explicitly deprecated by its own maintainers: as of Python 3.11, its functionality was upstreamed into the standard library, and the repository has moved under the aio-libs-abandoned GitHub organization and is archived. It remains widely installed as a transitive dependency of packages that still support Python versions older than 3.11, and version 5.0+ provides a compatibility shim that dual-mode delegates to asyncio.Timeout on 3.11+.
What You Get
timeout(delay)- async context manager that cancels its block afterdelayseconds, faster thanasyncio.wait_for()since it doesn’t spawn a new tasktimeout_at(when)- schedule a timeout at an absolute event-loop time instead of a relative delay.expired()/.when()- inspect whether the block was cancelled by the timeout and what its deadline was.reschedule()/.shift()- adjust or cancel a pending timeout while still inside the context manager- Python 3.11+ compatibility shim that delegates to stdlib
asyncio.Timeoutunder the hood
Common Use Cases
- Bounding the runtime of an asyncio operation (network call, DB query) without the task-creation overhead of
asyncio.wait_for() - Supporting Python versions older than 3.11 with the same timeout semantics that later became stdlib
- Legacy dependency chain: many older asyncio libraries (older aiohttp/redis-py versions) still pin this as a transitive dependency
- Migration bridge: codebases upgrading to Python 3.11+ can swap the import for stdlib
asyncio.timeoutwith no API changes
Under The Hood
Architecture - The entire implementation lives in a single 276-line module, async_timeout/__init__.py, defining a Timeout class that wraps loop.call_at() to schedule a cancellation callback and exposes it via two factory functions, timeout() and timeout_at(); the callback throws asyncio.CancelledError into the current task, which the context manager’s __aexit__ intercepts and converts to TimeoutError if triggered by expiry rather than user code. Tech Stack - Pure Python with zero runtime dependencies, targeting the asyncio event loop API directly (loop.time(), loop.call_at()); packaged with a standard setup.py/pyproject.toml and tested via a single tests/test_timeout.py file. Code Quality - Small, single-file, single-purpose codebase with focused test coverage of expiry, rescheduling, and nested-timeout edge cases; CI badges (GitHub Actions, Codecov) in the README indicate coverage was tracked, though the project’s own README now states it is deprecated and no longer actively supported. API Design - The API is minimal by design — one context manager, one absolute-time variant, and a handful of inspection/reschedule methods — which made it easy to port verbatim into Python 3.11’s stdlib asyncio.timeout; new projects on 3.11+ are explicitly directed by the README to prefer the stdlib version and use this package only for backward-compatible dual support.
Used by 8 apps in this directory
Dragonfly
Databases · Developer Tools · Devops
A modern Redis and Memcached replacement engineered for multi-core servers — delivering 25x more throughput, better cache hit rates, and up to 80% lower memory consumption with full API compatibility.
knowhere
AI Development · Developer Tools
Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.
marimo
Developer Tools · Data Engineering
A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.
Open WebUI
AI Assistants · AI Agents
The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.
Phase Console
Security · Devops
End-to-end encrypted secrets management for engineering teams — from local dev to Kubernetes production.
PostgresML
Databases · AI Development
Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.
Second Me
Productivity · AI Assistants
Train a locally hosted AI twin on your own memories—then connect it to the world through a decentralized identity network.
Taiga Back
Project Management · Developer Tools
Self-hosted agile project management backend with Scrum, Kanban, issue tracking, and a full REST API — built on Django and PostgreSQL.