blockbuster
Utility to detect blocking calls in the async event loop
What it is and what it does
Blockbuster is a testing utility that detects blocking calls within an asyncio event loop by wrapping common blocking functions from modules like time, os, socket, io, sqlite3, and threading. When a blocking operation is called from within an async context, it raises a BlockingError to alert developers. This helps identify performance bottlenecks and unpredictable behavior that can occur when blocking operations halt the entire event loop.
The package works by monkey-patching standard library functions and checking whether they are being invoked from within an asyncio event loop. It can be used manually by instantiating and activating a BlockBuster instance, as a context manager, or integrated into pytest test suites via fixtures. It supports customization through adding custom rules for third-party libraries and allowing blocking calls in specific contexts.
Use it for:
- Integrate into pytest test suites to automatically catch blocking calls in async code during test execution.
- Verify that refactored legacy code no longer makes blocking calls when converted to async.
- Identify third-party library calls that inadvertently block the event loop during development.
- Validate that async APIs do not call blocking functions like time.sleep or file I/O operations.
- Catch blocking socket or database operations in async networking or data-access layers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Blockbuster detects and prevents blocking calls within an asyncio event loop by wrapping common blocking functions and raising BlockingError when they are called from async contexts.
Yes, if you write asyncio code and want to catch blocking calls during testing. The package is actively maintained, has low install friction, carries no known vulnerabilities, and solves a real problem in async development. The alpha status and single external dependency are minor considerations; the permissive license and broad Python version support make it straightforward to adopt in test suites.
Install
blockbuster on PyPI
pip
pip install blockbusteruv
uv add blockbusterpoetry
poetry add blockbusterInstalling blockbuster
Before you install
Low install friction with a single runtime dependency (forbiddenfruit). Package is actively maintained with recent commits and marked as alpha-stage. Supports Python 3.8 through 3.13.
License in practice
Licensed under Apache Software License (permissive), which allows commercial and private use with minimal restrictions.
Quickstart
pip install blockbuster
from blockbuster import BlockBuster
blockbuster = BlockBuster()
blockbuster.activate()
# Blocking calls within asyncio will now raise BlockingError
Requires asyncio event loop to be running; only detects blocking calls within active async contexts. Works with CPython; other implementations require setattr monkey-patching support.
Verify before relying
- Whether forbiddenfruit dependency introduces any compatibility or maintenance concerns not evident from the fact sheet.
- Performance overhead of wrapping blocking functions during test execution.
- Coverage of blocking calls in C extensions from third-party libraries beyond the documented list.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — forbiddenfruit |
| Maintenance | actively maintained — 252 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,820,467/month — #2,489 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: blockbuster-1.5.26-py3-none-any.whl
Keywords: async, asyncio, block, detect, event loop
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
aiocopDetects and logs blocking I/O and CPU calls in…
permissive · top 15,000 on PyPI
aioshutilProvides async-friendly versions of shutil…
permissive · top 15,000 on PyPI
aioprocessingProvides asyncio-compatible wrappers around…
permissive · top 15,000 on PyPI
pyleakDetects leaked asyncio tasks, threads, and…
unclear · top 15,000 on PyPI
aiofilesProvides non-blocking file I/O for asyncio…
permissive · top 1,000 on PyPI
asynctestExtends Python's unittest module with test…
permissive · top 5,000 on PyPI
asyncerAsyncer provides utility functions for working…
permissive · top 5,000 on PyPI
asyncclickAsyncclick provides a fork of Click that…
permissive · top 5,000 on PyPI
synchronicityWraps async functions, generators, and classes…
permissive · top 1,000 on PyPI
pyserial-asyncioAdds async/await support to pyserial for…
permissive · top 15,000 on PyPI