async-timeout

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

Library
PyPI
v5.0.1
571stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
47/100Fair
Development Activity16
Maintenance20
Community72
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
71/100Good
Architecture68
Code Quality75
Innovation55
Learning Curve85

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 8 apps in this directory

C++
74%
Other

Dragonfly

Databases · Developer Tools · Devops

31,013

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++74%
Python16%
Updated today
Python
83%
Apache 2.0

knowhere

AI Development · Developer Tools

2,515

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

View details
83
Repo Health
75
Technical
70
Dependency
Built with
Python83%
HTML16%
Updated today
Python
61%
Apache 2.0

marimo

Developer Tools · Data Engineering

22,393

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
90
Repo Health
91
Technical
66
Dependency
Built with
Python61%
TypeScript37%
Updated today
Python
37%
Other

Open WebUI

AI Assistants · AI Agents

149,204

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
Python37%
Svelte33%
JavaScript22%
Updated today
TypeScript
55%
Other

Phase Console

Security · Devops

904

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

View details
84
Repo Health
73
Technical
67
Dependency
Built with
TypeScript55%
Python44%
Updated today
Rust
63%
MIT

PostgresML

Databases · AI Development

6,817

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

View details
51
Repo Health
76
Technical
65
Dependency
Built with
Rust63%
JavaScript11%
Updated 1 years ago
Python
76%
Apache 2.0

Second Me

Productivity · AI Assistants

15,668

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
Python76%
TypeScript19%
Updated 10 months ago
Python
97%
MPL 2.0

Taiga Back

Project Management · Developer Tools

846

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

View details
68
Repo Health
74
Technical
63
Dependency
Built with
Python97%
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

Search