brotli-asgi
A compression AGSI middleware using brotli
Decision gist · record as of 2026-08-14
Yes, if you're running an ASGI framework and want better compression than gzip. The package is lightweight, has no security vulnerabilities, and supports Python 3.9–3.14. Maintenance is aging but stable; the last release was 224 days ago and the repository remains active. Install it if bandwidth reduction matters for your workload and your clients support Brotli.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Installs cleanly with only two runtime dependencies (starlette and brotli).
- Maintenance is aging—last release was 224 days ago—but the repository remains active and unarchived with a recent commit on 2026-01-02.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
last release 2026-01-02 (224 days) · last repo commit 2026-01-02 · 86 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 678,044 downloads/mo, #5,378 on PyPI
Alternatives
Verify before relying
pip install brotli-asgi
from brotli_asgi import BrotliMiddleware
from starlette.applications import Starlette
from starlette.middleware import Middleware
app = Starlette(middleware=[Middleware(BrotliMiddleware)])- Performance gains over gzip in production workloads with typical response sizes and quality settings
- Browser compatibility breakdown for older clients not supporting Brotli
- CPU overhead during compression relative to gzip at different quality levels
What it is and what it does
BrotliMiddleware is an ASGI middleware that automatically compresses HTTP responses using Brotli encoding. It integrates directly into Starlette and other ASGI frameworks, intercepting responses and applying compression before they reach the client. The middleware respects Accept-Encoding headers and can fall back to gzip for clients that don't support Brotli.
You configure it by adding it to your application's middleware stack, optionally tuning compression quality (0–11), mode (generic, text, or font), window size, block size, and minimum response size threshold. It skips responses that already have Content-Encoding set to avoid double-encoding, and it's designed as a direct replacement for the GZipMiddleware shipped with Starlette.
Use it for
- Reduce bandwidth for JSON APIs and web services by compressing responses with Brotli instead of gzip
- Serve static HTML and text content over the web with better compression density than gzip
- Add compression to ASGI applications without writing custom middleware
- Optimize WOFF 2.0 font delivery using Brotli's font-specific compression mode
- Maintain gzip compatibility for older clients while preferring Brotli for modern browsers
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you're running an ASGI framework and want better compression than gzip.
The package is lightweight, has no security vulnerabilities, and supports Python 3.9–3.14. Maintenance is aging but stable; the last release was 224 days ago and the repository remains active. Install it if bandwidth reduction matters for your workload and your clients support Brotli.
Install
brotli-asgi on PyPI
Before you install
Installs cleanly with only two runtime dependencies (starlette and brotli). Maintenance is aging—last release was 224 days ago—but the repository remains active and unarchived with a recent commit on 2026-01-02.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
pip install brotli-asgi
from brotli_asgi import BrotliMiddleware
from starlette.applications import Starlette
from starlette.middleware import Middleware
app = Starlette(middleware=[Middleware(BrotliMiddleware)])
Verify before relying
- Performance gains over gzip in production workloads with typical response sizes and quality settings
- Browser compatibility breakdown for older clients not supporting Brotli
- CPU overhead during compression relative to gzip at different quality levels
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesstarlettebrotli |
| Maintenance | Aging 224 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 678,044 / month, #5,378 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: Web EnvironmentOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9 |
Evidence: brotli_asgi-1.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “brotli compression middleware asgi”
- brotli-asgiBrotliMiddleware adds Brotli compression to ASGI applications as a…
- starlette-compressMiddleware for Starlette and FastAPI that compresses HTTP responses…
- starlette-cramjamMiddleware for Starlette that compresses HTTP responses using Brotli,…
Give your agent the search over MCP, or paste the wish link into any chat.
More WWW/HTTP packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
h11 is a pure-Python HTTP/1.1 protocol implementation that handles parsing and serializing HTTP messages without any built-in I/O, letting you integrate it with any network layer you choose.
HTTPX is a fully featured HTTP client library for Python that provides both sync and async APIs, with support for HTTP/1.1 and HTTP/2, plus an integrated command-line client.
Install it if you are building new projects or modernizing existing ones that rely on HTTP.
A minimal low-level HTTP client library that sends HTTP requests with thread-safe and task-safe connection pooling, supporting HTTP/1.1, HTTP/2, proxies, and both sync and async interfaces.
aiohttp is an async HTTP client and server framework built on asyncio, supporting both WebSockets and middleware-based routing for building concurrent web applications.
Install it if you need async HTTP client or server capabilities in asyncio-based applications.
See also starlette-compress · starlette-cramjam · Flask-Compress · brotlipy · opentelemetry-instrumentation-asgi · brotlicffi · a2wsgi · asgi-correlation-id · servestatic · opentelemetry-util-http