Registry / http-networking / aiohttp-fast-zlib

aiohttp-fast-zlib

JSON →
library0.3.0pypypi✓ verified 83d ago

aiohttp-fast-zlib is a Python library (current version 0.3.0) that replaces the default `zlib` usage in `aiohttp` with faster alternatives like `isal` or `zlib-ng`. This significantly improves compression and decompression performance, especially for `aiohttp`'s WebSocket connections, where `zlib` can be a bottleneck. The library has seen several updates over the past year, indicating active maintenance and development.

pip install aiohttp-fast-zlib
INSTALL
IMPORT
SIG · AIOHTTP-FAST-ZLIB
A
aiohttp-fast-zlib
http-networkingpythonv0.3.0
Install
3.9s avg
Import
Disk
27MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.960 runs
installs and imports cleanly · install 0.0s · import 0.000s · 28.1MB
glibc
py 3.103.960 runs
installs and imports cleanly · install 3.9s · import 0.000s · 30MB
27MB installed
● package 27MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

enable
from aiohttp_fast_zlib import enable
import aiohttp_zlib_fast
disable
from aiohttp_fast_zlib import disable
set_zlib_backend
from aiohttp_fast_zlib import set_zlib_backend

This quickstart demonstrates how to enable `aiohttp-fast-zlib` and then use a standard `aiohttp.ClientSession` to make a request. The `enable()` call patches `aiohttp` globally to use the faster zlib backend. You can set the `TEST_URL` environment variable to point to a service that returns gzipped content (e.g., `httpbin.org/gzip`) to observe its effect.

import aiohttp import asyncio import os import aiohttp_zlib_fast # Enable the fast zlib backend. isal is preferred if available, then zlib-ng, else standard zlib. aiohttp_zlib_fast.enable() async def fetch(session, url): async with session.get(url) as response: print(f"Status: {response.status}") print(f"Content-type: {response.headers.get('content-type')}") # If the response is compressed, aiohttp will decompress it using the enabled backend text = await response.text() print(f"Body snippet: {text[:100]}...") async def main(): async with aiohttp.ClientSession() as session: # Use a real URL, or an httpbin-like service that supports compression await fetch(session, os.environ.get('TEST_URL', 'http://httpbin.org/gzip')) if __name__ == '__main__': asyncio.run(main())
Debug
Known issues
gotchaPerformance will be degraded if neither 'isal' nor 'zlib-ng' are installed alongside 'aiohttp-fast-zlib'. The library will silently fall back to the slower standard Python 'zlib' module.
fix
Install with an extra: `pip install aiohttp-fast-zlib[isal]` or `pip install aiohttp-fast-zlib[zlib-ng]`.
affects: All versions
breakingaiohttp-fast-zlib v0.3.0 introduces support for aiohttp 3.12 and newer. Older versions of aiohttp-fast-zlib had different aiohttp compatibility requirements. Always check the project's PyPI or GitHub page for precise aiohttp version compatibility with the specific aiohttp-fast-zlib version you are using.
fix
Ensure your `aiohttp` version meets the requirements of `aiohttp-fast-zlib`. For v0.3.0, ensure `aiohttp>=3.12.0` is installed. If using an older `aiohttp-fast-zlib`, you may need an older `aiohttp`.
affects: >=0.3.0 (specifically related to aiohttp version changes)
gotchaAiohttp itself (>=3.12) provides `aiohttp.set_zlib_backend()` for manually specifying a zlib-compatible module. `aiohttp-fast-zlib` offers automatic detection and fallback, but direct `aiohttp.set_zlib_backend()` calls will override its effects.
fix
If using `aiohttp-fast-zlib`, rely on its `enable()` function for automatic backend selection. Avoid `aiohttp.set_zlib_backend()` unless you explicitly want to manage the zlib backend yourself and override `aiohttp-fast-zlib`'s behavior.
affects: aiohttp-fast-zlib all versions with aiohttp >=3.12
Upgrade
Version history
0.3.0latest on PyPI · released Jun 7, 2025
Audit
Dependencies
aiohttprequiredCore dependency for asynchronous HTTP client/server functionality. Version 0.3.0 requires aiohttp>=3.12.0.
python-isaloptionalOptional dependency to enable the highly optimized ISA-L compression library. Recommended for best performance.
python-zlib-ngoptionalOptional dependency to enable the zlib-ng compression library, another fast alternative.
Agent activity
60 hits · last 30 days
node
48
Amazon
1
OpenAI (training)
1
Resources
aiohttp-fast-zlib — pip install aiohttp-fast-zlib · libregistry