$npx skillfedfor your agent

starlette-compress

Compression middleware for Starlette - supporting ZStd, Brotli, and GZip

Worth itPyPI Python ModulesReleased Jul 20261.1M downloads / mo0BSDPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — starlette_compress-1.8.0-py3-none-any.whl
v1.8.0 · released 2026-07-18 · Python >=3.9 · 4 runtime deps: brotli, brotlicffi, starlette, zstandard

Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and offers a straightforward drop-in middleware for Starlette/FastAPI with more compression options and better defaults than the built-in alternative. Low install friction and broad Python version support make it a practical choice for any Starlette or FastAPI project needing response compression.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction with four runtime dependencies (brotli, brotlicffi, starlette, zstandard).
  • Actively maintained with a release 27 days ago and recent commits.
  • Supports Python 3.9 through 3.14.

License · maintenance · safety

0BSD (permissive) — Licensed under 0BSD (Zero-Clause BSD), a permissive public domain dedication with no restrictions on use, modification, or distribution.

last release 2026-07-18 (27 days) · last repo commit 2026-08-14 · 3 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,114,521 downloads/mo, #4,351 on PyPI

Verify before relying

pip install starlette-compress

from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette_compress import CompressMiddleware

middleware = [Middleware(CompressMiddleware)]
app = Starlette(routes=..., middleware=middleware)
  • Performance impact compared to Starlette's built-in GZipMiddleware under typical production loads
  • Whether all four runtime dependencies (brotli, brotlicffi, starlette, zstandard) are always required or conditionally installed
Same gist for agents: .md · .json

What it is and what it does

starlette-compress is a middleware layer for Starlette and FastAPI applications that automatically compresses HTTP responses using one of three algorithms: ZStd, Brotli, or GZip. It sits between your application and the client, intercepting responses and reducing their size before transmission. The middleware applies sensible defaults—compressing responses 500 bytes or larger, using compression level 4 for all algorithms—while remaining configurable for different minimum sizes, compression levels, and content types.

The package handles both standard request-response flows and streaming scenarios like Server-Sent Events (SSE), where it flushes the compressor after each message to maintain low latency. It works with asyncio and trio backends, supports modern Python versions (3.9 through 3.14), and requires four runtime dependencies: starlette itself, plus brotli, brotlicffi, and zstandard for the respective compression algorithms.

Use it for

  • Reduce bandwidth on Starlette or FastAPI APIs by automatically compressing JSON, HTML, and text responses
  • Add ZStd or Brotli compression to applications that only have GZip available in Starlette's built-in middleware
  • Compress Server-Sent Events (SSE) streams with per-message flushing to maintain real-time delivery
  • Tune compression levels per algorithm to balance file size reduction against CPU cost for specific workloads
  • Manage compression for custom content types or opt out of compression for specific response types

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The package is actively maintained, has no known vulnerabilities, uses a permissive license, and offers a straightforward drop-in middleware for Starlette/FastAPI with more compression options and better defaults than the built-in alternative. Low install friction and broad Python version support make it a practical choice for any Starlette or FastAPI project needing response compression.

Install

starlette-compress on PyPI

Before you install

Low install friction with four runtime dependencies (brotli, brotlicffi, starlette, zstandard). Actively maintained with a release 27 days ago and recent commits. Supports Python 3.9 through 3.14.

License in practice

Licensed under 0BSD (Zero-Clause BSD), a permissive public domain dedication with no restrictions on use, modification, or distribution.

Quickstart

pip install starlette-compress

from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette_compress import CompressMiddleware

middleware = [Middleware(CompressMiddleware)]
app = Starlette(routes=..., middleware=middleware)

Verify before relying

  • Performance impact compared to Starlette's built-in GZipMiddleware under typical production loads
  • Whether all four runtime dependencies (brotli, brotlicffi, starlette, zstandard) are always required or conditionally installed

Package facts

License0BSD permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
4 packages
brotlibrotlicffistarlettezstandard
MaintenanceActively maintained 27 days since the last release
Last repo commit
First released
Downloads1,114,521 / month, #4,351 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: AnyIOFramework :: AsyncIOFramework :: FastAPIFramework :: TrioIntended Audience :: DevelopersLicense :: OSI Approved :: Zero-Clause BSD (0BSD)Operating 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.9Topic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Internet :: WWW/HTTP :: WSGI :: MiddlewareTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Evidence: starlette_compress-1.8.0-py3-none-any.whl

Tags

Capabilities
starlette response compression middlewarefastapi gzip brotli zstd compressionhttp response compression asgistarlette middleware compressionzstandard brotli gzip middlewareasgi response encodingweb response compression
Topics
middlewarecompressionasgi
PyPI keywords
asgibrotlicompressiondeflateencodingfastapigziphttpmiddlewareperformanceresponsestarlettewebzstandardzstd

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 › “starlette response compression middleware”

  • starlette-compressMiddleware for Starlette and FastAPI that compresses HTTP responses…
  • starlette-cramjamMiddleware for Starlette that compresses HTTP responses using Brotli,…
  • brotli-asgiBrotliMiddleware adds Brotli compression to ASGI applications as a…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also brotli-asgi · starlette-cramjam · starlette-context · Flask-Compress · starlette · Secweb · starlette-csrf · fastapi-events · starsessions · whitenoise