async-timeout

An asyncio-compatible timeout context manager for Python, now superseded by stdlib asyncio.timeout

Library
PyPI
v5.0.1
572 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
46 /100 Fair
Development Activity 12
Maintenance 20
Community 72
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
71 /100 Good
Architecture 68
Code Quality 75
Innovation 55
Learning Curve 85

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 after delay seconds, faster than asyncio.wait_for() since it doesn’t spawn a new task
  • timeout_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.Timeout under 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.timeout with 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 9 apps in this directory

C++
73%
Other

Dragonfly

Databases · Developer Tools · Devops

31,706

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.

View details
90
Repo Health
9
Technical
71
Dependency
Built with
C++ 73%
Python 16%
Updated 1 weeks ago
C++
73%
Other

Dragonfly

Databases · Developer Tools · Devops

31,706

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.

View details
90
Repo Health
9
Technical
71
Dependency
Built with
C++ 73%
Python 16%
Updated 1 weeks ago
Python
86%
Apache 2.0

knowhere

AI Development · AI Memory · Developer Tools

3,541

Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.

View details
82
Repo Health
75
Technical
66
Dependency
Built with
Python 86%
HTML 14%
Updated 2 weeks ago
Python
62%
Apache 2.0

marimo

Data Engineering · Developer Tools

22,918

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.

View details
89
Repo Health
91
Technical
65
Dependency
Built with
Python 62%
TypeScript 37%
Updated 1 weeks ago
Python
37%
Other

Open WebUI

AI Agents · AI Assistants

153,390

The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.

View details
91
Repo Health
75
Technical
66
Dependency
Built with
Python 37%
Svelte 34%
JavaScript 21%
Updated 1 weeks ago
TypeScript
51%
Other

Phase Console

Devops · Security

924

End-to-end encrypted secrets management for engineering teams — from local dev to Kubernetes production.

View details
84
Repo Health
73
Technical
63
Dependency
Built with
TypeScript 51%
Python 48%
Updated 1 weeks ago
Rust
63%
MIT

PostgresML

AI Development · Databases

6,825

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust 63%
JavaScript 11%
Updated 1 years ago
Python
76%
Apache 2.0

Second Me

AI Assistants · Productivity

15,690

Train a locally hosted AI twin on your own memories—then connect it to the world through a decentralized identity network.

View details
41
Repo Health
75
Technical
67
Dependency
Built with
Python 76%
TypeScript 19%
Updated 1 years ago
Python
97%
MPL 2.0

Taiga Back

Developer Tools · Project Management

854

Self-hosted agile project management backend with Scrum, Kanban, issue tracking, and a full REST API — built on Django and PostgreSQL.

View details
76
Repo Health
74
Technical
64
Dependency
Built with
Python 97%
Updated 2 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers